#include "pch.h" #include "GameManager.h" GameManager* GameManager::m_pInstance = nullptr; GameManager& GameManager::GetInstance() { if (m_pInstance == nullptr) { m_pInstance = new GameManager(); } return *m_pInstance; } void GameManager::SetMainScreen(MainScreen* pMainScreen) { m_pMainScreen = pMainScreen; //TODO: not the best but ¯\_(ツ)_/¯ } void GameManager::SetFuel(int fuel) { m_Fuel = fuel; } int GameManager::GetFuel() const { return m_Fuel; } void GameManager::DecreaseFuel(int fuel) { m_Fuel -= fuel; } void GameManager::AddFuel(int fuel) { m_Fuel += fuel; } void GameManager::SetHullIntegrity(int hullIntegrity) { m_HullIntegrity = hullIntegrity; } int GameManager::GetHullIntegrity() const { return m_HullIntegrity; } void GameManager::DamageHull(int damage) { m_HullIntegrity -= damage; } void GameManager::SetScore(int score) { m_Score = score; } int GameManager::GetScore() const { return m_Score; } void GameManager::IncreaseScore(int score) { m_Score += score; } void GameManager::Update(float elapsedSecs) { m_pMainScreen->SetFuelMeterValue(m_Fuel); m_pMainScreen->SetHullMeterValue(m_HullIntegrity); m_pMainScreen->SetScore(std::to_string(m_Score)); }