Exemple #1
0
        private void Awake()
        {
            if (Instance != null)
            {
                Destroy(gameObject);
                return;
            }

            SnapshotManager = new SnapshotManager();
            InputManager    = new InputManager();
            Instance        = this;
            DontDestroyOnLoad(this);

            PongSettings = new GameSettings()
            {
                GameMode = PongGame.Mode.PvPHost
            };

            switch (SceneManager.GetActiveScene().name)
            {
            case MENU_SCENE_NAME:
                CurrentState = State.Menu;
                break;

            case PONG_SCENE_NAME:
                CurrentState = State.Pong;
                break;
            }
        }
Exemple #2
0
        private void PrepareNewState(State newState)
        {
            switch (newState)
            {
            case State.Pong:
                InputManager.Reset();
                SnapshotManager.Reset();
                SceneManager.LoadScene(PONG_SCENE_NAME);
                break;

            case State.Menu:
                SceneManager.LoadScene(MENU_SCENE_NAME);
                break;
            }
        }