|
|
@ -53,6 +53,10 @@ namespace components { |
|
|
|
int damage = 0; |
|
|
|
int damage = 0; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct Curative { |
|
|
|
|
|
|
|
int hp = 10; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
inline void configure(DinkyECS::World &world, DinkyECS::Entity entity, json& entity_data) { |
|
|
|
inline void configure(DinkyECS::World &world, DinkyECS::Entity entity, json& entity_data) { |
|
|
|
for(auto &comp : entity_data["components"]) { |
|
|
|
for(auto &comp : entity_data["components"]) { |
|
|
|
json& config = comp["config"]; |
|
|
|
json& config = comp["config"]; |
|
|
@ -69,6 +73,8 @@ namespace components { |
|
|
|
world.set<EnemyConfig>(entity, {config["hearing_distance"]}); |
|
|
|
world.set<EnemyConfig>(entity, {config["hearing_distance"]}); |
|
|
|
} else if(comp["type"] == "Combat") { |
|
|
|
} else if(comp["type"] == "Combat") { |
|
|
|
world.set<Combat>(entity, {config["hp"], config["damage"]}); |
|
|
|
world.set<Combat>(entity, {config["hp"], config["damage"]}); |
|
|
|
|
|
|
|
} else if(comp["type"] == "Curative") { |
|
|
|
|
|
|
|
world.set<Curative>(entity, {config["hp"]}); |
|
|
|
} else if(comp["type"] == "Motion") { |
|
|
|
} else if(comp["type"] == "Motion") { |
|
|
|
world.set<Motion>(entity, {config["dx"], config["dy"], config["random"]}); |
|
|
|
world.set<Motion>(entity, {config["dx"], config["dy"], config["random"]}); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|