コード例 #1
0
ファイル: GameController.cs プロジェクト: disas69/Asteroids
        private StateMachine <GameState> CreateStateMachine()
        {
            var stateMachine = new StateMachine <GameState>(GameState.Idle);

            stateMachine.AddTransition(GameState.Idle, GameState.Play, ActivatePlay);
            stateMachine.AddTransition(GameState.Play, GameState.GameOver, ActivateGameOver);
            stateMachine.AddTransition(GameState.GameOver, GameState.Play, ActivatePlay);
            stateMachine.AddTransition(GameState.GameOver, GameState.Idle, ActivateStart);

            return(stateMachine);
        }
コード例 #2
0
        private void Start()
        {
            Input.multiTouchEnabled = false;

            _activeRings      = new List <Ring>();
            _gameStateMachine = new StateMachine <GameState>();
            _gameStateMachine.AddTransition(GameState.Idle, GameState.Play, StartGame);
            _gameStateMachine.AddTransition(GameState.Play, GameState.Stop, StopGame);
            _gameStateMachine.AddTransition(GameState.Stop, GameState.Play, StartGame);
            _gameStateMachine.SetState(GameState.Idle);

            _ringsPrefabs = _ringsStorage.GetRingsPrefabs();

            if (_navigation != null)
            {
                _navigation.OpenScreen <StartPage>();
            }
            else
            {
                Debug.LogError("NavigationProvider is not assigned");
            }
        }