Add sun / moon, started on score / GameManager

This commit is contained in:
Bram Verhulst
2024-05-16 12:44:53 +02:00
parent 8866f33c09
commit 3c83e566dd
12 changed files with 176 additions and 35 deletions

View File

@@ -1,2 +1,50 @@
#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));
}