예제 #1
0
    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;
        }
    }
예제 #2
0
    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);
        }
    }
예제 #3
0
 void WinnerIdChanged(NinjaGameManagerModel model, int value)
 {
     Debug.Log("WinnerIdChanged " + value);
 }