void GameStateChanged(NinjaGameManagerModel model, uint value) { Debug.Log("Current GameState: " + (GameState)value); OnGameStateChanged?.Invoke((GameState)value); switch (value) { case ((uint)NinjaGameManager.GameState.Intro): break; case ((uint)NinjaGameManager.GameState.RoundSetUp): DoRoundSetUp(); break; case ((uint)NinjaGameManager.GameState.P1AttackRound): StartCoroutine(DoP1AttackRound()); break; case ((uint)NinjaGameManager.GameState.Break): break; case ((uint)NinjaGameManager.GameState.P2AttackRound): StartCoroutine(DoP2AttackRound()); break; case ((uint)NinjaGameManager.GameState.GameResults): DoGameResults(); break; } }
void SetModel(NinjaGameManagerModel model) { if (_model != null) { // Clear events _model.gameStateDidChange -= GameStateChanged; _model.winnerIdDidChange -= WinnerIdChanged; } _model = model; if (_model != null) { // Register for events _model.gameStateDidChange += GameStateChanged; _model.winnerIdDidChange += WinnerIdChanged; GameStateChanged(_model, _model.gameState); } }
void WinnerIdChanged(NinjaGameManagerModel model, int value) { Debug.Log("WinnerIdChanged " + value); }