From dc10fd453cda92bdca8b99deded53921665a5f24 Mon Sep 17 00:00:00 2001 From: quinndu0 <160988691+ntut-Tu@users.noreply.github.com> Date: Fri, 14 Jun 2024 12:10:17 +0800 Subject: [PATCH] formal sandbox --- include/AI/AIGroupCommander.hpp | 2 +- src/Scene/SandBoxScene.cpp | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/include/AI/AIGroupCommander.hpp b/include/AI/AIGroupCommander.hpp index fc995f5..7247fcd 100644 --- a/include/AI/AIGroupCommander.hpp +++ b/include/AI/AIGroupCommander.hpp @@ -156,7 +156,7 @@ class AIGroupCommander { glm::vec2 findTargetForOffensiveUnit(std::shared_ptr unit){ glm::vec2 targetCell = {-10.f,-10.f}; //issue: empty group should delete before this - if(static_cast(m_offensiveGroup.size())>=static_cast(m_PlayerUnitManager->getAvatarManager()->getAvatarArray().size())){ + if(static_cast(m_offensiveGroup.size())>=static_cast(m_PlayerUnitManager->getAvatarManager()->getAvatarArray().size())&&!m_PlayerUnitManager->getStructureManager()->getStructureArray()->getBuiltStructureArray().empty()){ if(!m_PlayerUnitManager->getStructureManager()->getStructureArray()->getBuiltStructureArray().empty()){ targetCell=m_PlayerUnitManager->getStructureManager()->getStructureArray()->getBuiltStructureArray().front()->getTopRightCell(); }else{ diff --git a/src/Scene/SandBoxScene.cpp b/src/Scene/SandBoxScene.cpp index 6239c83..7436f13 100644 --- a/src/Scene/SandBoxScene.cpp +++ b/src/Scene/SandBoxScene.cpp @@ -140,12 +140,14 @@ void SandBoxScene::stageUpdate() { m_stage = Stages::STAGE3; m_EnemyScripts->Start(m_GameObjectManager, m_EnemyObjectManager, m_Map); + stageStart(); } if (Util::Input::IsKeyPressed(Util::Keycode::NUM_4)) { m_stage = Stages::STAGE4; m_EnemyScripts->Start(m_GameObjectManager, m_EnemyObjectManager, m_Map, true); + m_EnemyObjectManager->setCheatMode(true); stageStart(); } }else if(m_stage == Stages::FORMAL_START){ @@ -156,15 +158,11 @@ void SandBoxScene::stageUpdate() { } if(m_stage == Stages::PLAYER_WON){ - + }else if(m_stage == Stages::AI_WON){ } if (Util::Input::IsKeyPressed(Util::Keycode::DEBUG_KEY )) { - if(m_EnemyObjectManager->getCheatMode()){ - m_EnemyObjectManager->setCheatMode(false); - }else{ - m_EnemyObjectManager->setCheatMode(true); - } + m_EnemyObjectManager->setCheatMode(true); } }