Deux Ex Machina
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#include "pch.h"
|
||||
#include "GameManager.h"
|
||||
|
||||
#include "Gui/Screens/ScreenManager.h"
|
||||
|
||||
GameManager* GameManager::m_pInstance = nullptr;
|
||||
|
||||
|
||||
@@ -36,6 +38,9 @@ void GameManager::DecreaseFuel(float fuel) {
|
||||
}
|
||||
void GameManager::AddFuel(float fuel) {
|
||||
m_Fuel += fuel;
|
||||
if(m_Fuel > this->GetMaxFuel()) {
|
||||
m_Fuel = this->GetMaxFuel();
|
||||
}
|
||||
}
|
||||
void GameManager::SetHullIntegrity(int hullIntegrity) {
|
||||
m_HullIntegrity = hullIntegrity;
|
||||
@@ -72,11 +77,14 @@ void GameManager::Update(float elapsedSecs) {
|
||||
|
||||
if (m_HullIntegrity <= 0 or m_Fuel <= 0) {
|
||||
m_pPlayer->Die();
|
||||
m_GameOver = true;
|
||||
ScreenManager::GetInstance()->OpenScreen(ScreenManager::m_GameOverScreen);
|
||||
}
|
||||
|
||||
if(m_Fuel <= 20) {
|
||||
if(m_FuelLowSound->IsPlaying() == false) {
|
||||
m_FuelLowSound->Play(1);
|
||||
if(!m_GameOver) {
|
||||
if(m_Fuel <= 20) {
|
||||
if(m_FuelLowSound->IsPlaying() == false) {
|
||||
m_FuelLowSound->Play(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user