Add Alot
This commit is contained in:
@@ -3,16 +3,25 @@
|
||||
|
||||
GameManager* GameManager::m_pInstance = nullptr;
|
||||
|
||||
|
||||
GameManager& GameManager::GetInstance() {
|
||||
if (m_pInstance == nullptr) {
|
||||
m_pInstance = new GameManager();
|
||||
}
|
||||
return *m_pInstance;
|
||||
}
|
||||
void GameManager::DestroyInstance() {
|
||||
delete m_pInstance->m_pInventory;
|
||||
delete m_pInstance->m_FuelLowSound;
|
||||
delete m_pInstance;
|
||||
}
|
||||
void GameManager::SetMainScreen(MainScreen* pMainScreen) {
|
||||
m_pMainScreen = pMainScreen;
|
||||
//TODO: not the best but ¯\_(ツ)_/¯
|
||||
}
|
||||
void GameManager::SetPlayer(Player* pPlayer) {
|
||||
m_pPlayer = pPlayer;
|
||||
}
|
||||
void GameManager::SetFuel(float fuel) {
|
||||
m_Fuel = fuel;
|
||||
//Limit to 0 - MAXa
|
||||
@@ -59,7 +68,32 @@ void GameManager::Update(float elapsedSecs) {
|
||||
m_pMainScreen->SetFuelMeterValue(this->GetMaxFuel() - m_Fuel);
|
||||
m_pMainScreen->SetHullMeterValue(m_HullIntegrity);
|
||||
m_pMainScreen->SetScore(std::to_string(m_Score));
|
||||
m_pMainScreen->SetMoney("$ " + std::to_string(m_Money));
|
||||
|
||||
if (m_HullIntegrity <= 0 or m_Fuel <= 0) {
|
||||
m_pPlayer->Die();
|
||||
}
|
||||
|
||||
if(m_Fuel <= 20) {
|
||||
if(m_FuelLowSound->IsPlaying() == false) {
|
||||
m_FuelLowSound->Play(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
int GameManager::GetMaxFuel() {
|
||||
return 100; //TODO: change if i ever add upgrades
|
||||
}
|
||||
PlayerInventory* GameManager::GetInventory() {
|
||||
return m_pInventory;
|
||||
}
|
||||
Player* GameManager::GetPlayer() {
|
||||
return m_pPlayer;
|
||||
}
|
||||
GameManager::GameManager() {
|
||||
m_pInventory = new PlayerInventory();
|
||||
m_FuelLowSound = new SoundEffect{ "sound/fuel_low.wav" };
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user