diff options
Diffstat (limited to 'game/enemy/BattleScript.cpp')
-rw-r--r-- | game/enemy/BattleScript.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/game/enemy/BattleScript.cpp b/game/enemy/BattleScript.cpp index f482d5a..7bea79a 100644 --- a/game/enemy/BattleScript.cpp +++ b/game/enemy/BattleScript.cpp @@ -1,6 +1,6 @@ #include "BattleScript.h" -#include "EnemyScript.h" #include "../enemy/EnemyConfig.h" +#include "EnemyScript.h" #include "api/Transform.h" #include <crepe/api/AI.h> #include <crepe/api/BehaviorScript.h> @@ -20,8 +20,7 @@ void BattleScript::init() { void BattleScript::fixed_update(duration_t dt) { if (!battle_active) return; bool enemies_alive = false; - RefVector<AI> enemy_ai - = this->get_components_by_tag<AI>("enemy"); + RefVector<AI> enemy_ai = this->get_components_by_tag<AI>("enemy"); for (AI & ai : enemy_ai) { if (ai.active) { @@ -39,13 +38,13 @@ bool BattleScript::create_battle(const BattleStartEvent & e) { return false; } void BattleScript::spawn_enemies(int amount) { - RefVector<AI> enemy_ai - = this->get_components_by_tag<AI>("enemy"); + RefVector<AI> enemy_ai = this->get_components_by_tag<AI>("enemy"); std::uniform_real_distribution<float> dist(70, 150); int spawned = 0; for (int i = 0; i < 7; i++) { - AI& ai = enemy_ai[i]; - Transform& enemy_transform = this->get_components_by_id<Transform>(ai.game_object_id).front(); + AI & ai = enemy_ai[i]; + Transform & enemy_transform + = this->get_components_by_id<Transform>(ai.game_object_id).front(); if (ai.active == true || enemy_transform.position != ENEMY_POOL_LOCATION) continue; this->queue_event<SpawnEnemyEvent>( SpawnEnemyEvent { @@ -55,7 +54,7 @@ void BattleScript::spawn_enemies(int amount) { ai.game_object_id ); spawned++; - if(spawned >= amount){ + if (spawned >= amount) { return; } } |