43 lines
919 B
C++
43 lines
919 B
C++
#pragma once
|
|
|
|
#include "game/BaseGame.h"
|
|
#include "misc/Time.h"
|
|
#include "ServerWorld.h"
|
|
|
|
namespace td {
|
|
namespace server {
|
|
|
|
class Server;
|
|
|
|
class ServerGame : public game::Game, public game::GameListener {
|
|
private:
|
|
Server* m_Server;
|
|
ServerWorld m_ServerWorld;
|
|
utils::AutoTimer m_GoldMineTimer;
|
|
utils::AutoTimer m_MobStatesTimer;
|
|
utils::CooldownTimer m_EndGameCooldown;
|
|
public:
|
|
ServerGame(Server* server);
|
|
~ServerGame() {}
|
|
|
|
ServerWorld* GetServerWorld() { return &m_ServerWorld; }
|
|
|
|
virtual void Tick(std::uint64_t delta);
|
|
void StartGame();
|
|
|
|
// GameListener
|
|
|
|
virtual void OnGameStateUpdate(game::GameState newState);
|
|
virtual void OnGameBegin();
|
|
virtual void OnGameEnd();
|
|
virtual void OnGameClose();
|
|
private:
|
|
void BalanceTeams();
|
|
void UpdateMobStates();
|
|
void UpdateGoldMines();
|
|
void UpdatePlayerStats();
|
|
};
|
|
|
|
} // namespace game
|
|
} // namespace td
|