BomberUnits
...a Unity learning project
MatchManager Class Reference

Responsible for managing a single match. More...

+ Inheritance diagram for MatchManager:
+ Collaboration diagram for MatchManager:

Public Types

enum  MatchState { init, running, gameOver }
 

Public Member Functions

Player GetWinningPlayer ()
 
void Start ()
 
void OnDestroy ()
 

Static Public Member Functions

static MatchManager Get ()
 

Public Attributes

GameObject [] spawnTiles
 

Private Member Functions

void Awake ()
 
void OnPlayerDeath (PlayerIdNetData data)
 Upon each players death, the clients update the players status and assess whether the game has ended. More...
 
void CheckForMatchEnd ()
 Each players current status is held within its player information. More...
 
void SendPlayerSpawnInfo ()
 Sends information on player figure spawn locations. More...
 

Private Attributes

MatchState state
 
float drawSimultaneousDeathTolerance = 0.05f
 
Player winningPlayer
 

Static Private Attributes

static MatchManager instance
 Singleton pattern instance, not persistent!
 

Detailed Description

Responsible for managing a single match.

Is thus part of each level scene and destroyed with it. The static singleton access can therefore not be guaranteed to return a valid object!

Definition at line 11 of file MatchManager.cs.

Member Enumeration Documentation

◆ MatchState

enum MatchState
strong
Todo:
Remove as the match state can as well be inferred from the GameSM.

Definition at line 16 of file MatchManager.cs.

Member Function Documentation

◆ Awake()

void Awake ( )
inlineprivate
Todo:
: Only have a MatchManager on the Host. Move Board functionality to a board or Level object.

Definition at line 65 of file MatchManager.cs.

◆ CheckForMatchEnd()

void CheckForMatchEnd ( )
inlineprivate

Each players current status is held within its player information.

A reference to the winnings player is filled if the match result was not a draw. The player deaths are synchronized over clients, so the evaluation needs not to.

Definition at line 122 of file MatchManager.cs.

◆ OnPlayerDeath()

void OnPlayerDeath ( PlayerIdNetData  data)
inlineprivate

Upon each players death, the clients update the players status and assess whether the game has ended.

Todo:
: This can be done when player data changes. The state will have changed to 'dead'.

Invoke the match end check a bit later, if multiple players died at about the same time. Will be invoked multiple times as well in that case, debounced by the Match State itself.

Definition at line 104 of file MatchManager.cs.

◆ SendPlayerSpawnInfo()

void SendPlayerSpawnInfo ( )
inlineprivate

Sends information on player figure spawn locations.

This currently commences the game! These are randomized if set as such in the settings.

Todo:
: the spawn info should also contain the (synced) network time of the spawn. Rework the match startup phase in general (countdown, show-off, etc...).

Definition at line 148 of file MatchManager.cs.

◆ Start()

void Start ( )
inline
Todo:
Lock and unlock the message queue, so everyone has finished loading when events arrive! Read the Photon documentation regarding this. Assess the below delay, add an initial Pre-Match phase for loading etc.
Todo:
shift more responsibility to the Game states

Definition at line 78 of file MatchManager.cs.


The documentation for this class was generated from the following file: