Made a curative component really quick.
This commit is contained in:
parent
d6916b675e
commit
ee304c30e3
3 changed files with 24 additions and 0 deletions
|
@ -53,6 +53,10 @@ namespace components {
|
|||
int damage = 0;
|
||||
};
|
||||
|
||||
struct Curative {
|
||||
int hp = 10;
|
||||
};
|
||||
|
||||
inline void configure(DinkyECS::World &world, DinkyECS::Entity entity, json& entity_data) {
|
||||
for(auto &comp : entity_data["components"]) {
|
||||
json& config = comp["config"];
|
||||
|
@ -69,6 +73,8 @@ namespace components {
|
|||
world.set<EnemyConfig>(entity, {config["hearing_distance"]});
|
||||
} else if(comp["type"] == "Combat") {
|
||||
world.set<Combat>(entity, {config["hp"], config["damage"]});
|
||||
} else if(comp["type"] == "Curative") {
|
||||
world.set<Curative>(entity, {config["hp"]});
|
||||
} else if(comp["type"] == "Motion") {
|
||||
world.set<Motion>(entity, {config["dx"], config["dy"], config["random"]});
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue