Skip to content

Commit

Permalink
s
Browse files Browse the repository at this point in the history
  • Loading branch information
jonylu7 committed May 24, 2024
1 parent 5c9e9d9 commit d97e124
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
7 changes: 3 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ set(SRC_FILES

${SRC_DIR}/App.cpp

${SRC_DIR}/Enemy/Enemy.cpp

${SRC_DIR}/AI/Enemy.cpp
${SRC_DIR}/AI/EnemyScripts.cpp

${SRC_DIR}/Structure/Structure.cpp
Expand Down Expand Up @@ -225,8 +224,8 @@ set(INCLUDE_FILES
${INCLUDE_DIR}/Scene/SandBoxScene.hpp


${INCLUDE_DIR}/Enemy/Enemy.hpp
${INCLUDE_DIR}/Enemy/EnemyScripts.hpp
${INCLUDE_DIR}/AI/Enemy.hpp
${INCLUDE_DIR}/AI/EnemyScripts.hpp

${INCLUDE_DIR}/Core/Context.hpp
${INCLUDE_DIR}/Core/DebugMessageCallback.hpp
Expand Down
4 changes: 2 additions & 2 deletions include/Mechanics/BuiltStructure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ class BuiltStructure {
glm::vec2 getPlayerBarrackSpawnCell() { return m_PlayerBarrackCell; }
glm::vec2 getPlayerBarrackWayPointCell() { return m_PlayerWayPointCell; }

bool ifBarracksBuilt() {
bool ifBarrackBuilt() {
for (auto i : m_BuiltStructure) {
if (i->getID().getUnitType() == UnitType::BARRACKS) {
return true;
}
}
return false;
}
bool ifPowerPlantsBuilt() {
bool ifPowerPlantBuilt() {
for (auto i : m_BuiltStructure) {
if (i->getID().getUnitType() == UnitType::POWER_PLANT) {
return true;
Expand Down
File renamed without changes.
5 changes: 2 additions & 3 deletions src/Map/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ std::shared_ptr<TileClass> MapClass::getTileByCellPosition(glm::vec2 position) {

if (position.x > m_MapWdith - 1 || position.y > m_MapHeight - 1 ||
position.x < 0 || position.y < 0) {
std::cerr << "False Position Getting" << position.x << position.y
<< std::endl;
return nullptr;
LOG_DEBUG("False Position Getting");
return std::make_shared<TileClass>();
}
return m_Map[position.x][position.y];
}
Expand Down
8 changes: 3 additions & 5 deletions src/Scene/DefaultScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ void DefaultScene::Start() {

LOG_TRACE("Start");
// create map
m_Map->Init(98, 98);
m_Map->Init(60, 60);

/*
m_Map->getTileByCellPosition(glm::vec2(6, 5))->setWalkable(0);
Expand All @@ -22,13 +22,11 @@ void DefaultScene::Start() {
m_GameObjectManager->Start(m_Map);
m_UI->Start(m_Map, m_GameObjectManager);
m_GameObjectManager->setTotalCurrency(5000);
m_SceneCamera->Start(MapUtil::CellCoordToGlobal(glm::vec2(-10, -10)),
MapUtil::CellCoordToGlobal(glm::vec2(100, 100)));
m_SceneCamera->Start(MapUtil::CellCoordToGlobal(glm::vec2(-5, -5)),
MapUtil::CellCoordToGlobal(glm::vec2(70, 70)));
}

void DefaultScene::Update() {
// m_hunter->Update();
// m_runner->Update();

m_GameObjectManager->Update();

Expand Down
13 changes: 11 additions & 2 deletions src/Scene/TutorialScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ void TutorialScene::Start() {
m_SceneCamera->Start(MapUtil::CellCoordToGlobal(glm::vec2(-10, -10)),
MapUtil::CellCoordToGlobal(glm::vec2(100, 100)));

// m_EnemyScripts->Start(m_Enemy,m_GameObjectManager, m_EnemyObjectManager, m_Map);
// m_EnemyScripts->Start(m_Enemy,m_GameObjectManager,
// m_EnemyObjectManager, m_Map);

m_GameObjectManager->spawn(m_Map, UnitType::INFANTRY, HouseType::MY,
{5, 5});
Expand Down Expand Up @@ -136,7 +137,15 @@ void TutorialScene::stage2Update() {
structCount++;
}
}
if (structCount >= 3 ||
if (m_GameObjectManager->getStructureManager()
->getStructureArray()
->ifBarrackBuilt() &&
m_GameObjectManager->getStructureManager()
->getStructureArray()
->ifPowerPlantBuilt() &&
m_GameObjectManager->getStructureManager()
->getStructureArray()
->ifWarFactoryBuilt() ||
Util::Input::IsKeyPressed(Util::Keycode::DEBUG_KEY)) {
// change next stage's text&prop here
m_PlayerObjectivesText->SetDrawable(
Expand Down

0 comments on commit d97e124

Please sign in to comment.