|
|
|
#include "State_GameRun.h"
|
|
|
|
#include "Crawler.h"
|
|
|
|
#include "DEFINES.h"
|
|
|
|
#include "Menu.h"
|
|
|
|
|
|
|
|
INCLUDE_MONSTER_LIST
|
|
|
|
INCLUDE_game
|
|
|
|
|
|
|
|
void State_GameRun::OnStateChange(GameState*prevState){
|
|
|
|
if(Menu::IsMenuOpen()){
|
|
|
|
Menu::CloseAllMenus();
|
|
|
|
}
|
|
|
|
game->GetPlayer()->SetState(State::NORMAL);
|
|
|
|
};
|
|
|
|
void State_GameRun::OnUserUpdate(Crawler*game){
|
|
|
|
game->bossDisplayTimer=std::max(0.f,game->bossDisplayTimer-game->GetElapsedTime());
|
|
|
|
if(game->encounterStarted&&game->totalBossEncounterMobs>0){
|
|
|
|
game->encounterDuration+=game->GetElapsedTime();
|
|
|
|
}
|
|
|
|
|
|
|
|
game->HandleUserInput(game->GetElapsedTime());
|
|
|
|
|
|
|
|
game->UpdateEffects(game->GetElapsedTime());
|
|
|
|
game->GetPlayer()->Update(game->GetElapsedTime());
|
|
|
|
for(Monster&m:MONSTER_LIST){
|
|
|
|
m.Update(game->GetElapsedTime());
|
|
|
|
}
|
|
|
|
for(Monster&m:game->monstersToBeSpawned){
|
|
|
|
MONSTER_LIST.push_back(m);
|
|
|
|
}
|
|
|
|
game->monstersToBeSpawned.clear();
|
|
|
|
|
|
|
|
game->UpdateBullets(game->GetElapsedTime());
|
|
|
|
game->UpdateCamera(game->GetElapsedTime());
|
|
|
|
};
|
|
|
|
void State_GameRun::Draw(Crawler*game){
|
|
|
|
game->RenderHud();
|
|
|
|
};
|