Пример #1
0
        public override void OnStart()
        {
            GameController.ShouldUpdate = true;

            GameEngineInterface.ClearGameObjectCache();


            _logicProvidersByGameState.Clear(); //added this line b/c the dictionary keys already exist if you quit to the main menu and come back!
            _logicProvidersByGameState.Add(GameState.InGame, GameLogicProvider);
            _logicProvidersByGameState.Add(GameState.Pause, PauseLogicProvider);
            _logicProvidersByGameState.Add(GameState.WinTransition, WinTransitionLogicProvider);
            _logicProvidersByGameState.Add(GameState.Win, WinLogicProvider);
            _logicProvidersByGameState.Add(GameState.LoseTransition, LoseTransitionLogicProvider);
            _logicProvidersByGameState.Add(GameState.Lose, LoseLogicProvider);

            foreach (var curKvp in _logicProvidersByGameState)
            {
                curKvp.Value.OnStart();
            }

            CurLogicProvider = _logicProvidersByGameState[GameState.InGame];

            _InputStates[InputAxis.Cancel] = 0f;

            //var debugOutputGameObject = _gameEngineInterface.FindGameObject("txtDebugOutput");
            //_txtDebugOutput = debugOutputGameObject.GetComponent<IText>();
            //_txtDebugOutput.Text += Environment.NewLine + "OnStart()";

            SetAppState(AppState.Game);
            SetSceneState((int)GameState.InGame);
        }
Пример #2
0
    private void OnTriggerEnter(Collider other)
    {
        //if(!_previousCollisions.ContainsKey(other) || _previousCollisions[other] == false)
        //{
        //_previousCollisions[other] = true;

        var gameObjWrapper = GameEngineInterface.FindGameObject(other.gameObject.name);

        LogicHandler.OnCollision(this, gameObjWrapper);

        //Debug.Log("OnTriggerEnter");
        //}
    }
Пример #3
0
        //todo 2nd game: why do we need both LoadSceneAsync and SetAppState?
        public IAsyncOperation LoadSceneAsync(string sceneName)
        {
            JustBeatMaxLevel = false;                                                        //each time we start the level, we know the player hasn't just beaten the last level. This is necessary for the case of a player beating the last level and then going back to play another level

            var retVal = GameEngineInterface.LoadSceneAsync(Constants.SceneNames.GameScene); //todo: this should use the scene name from the parameter, not a hardcoded scene name

            if (retVal != null)
            {
                retVal.AllowSceneActivation = true;
            }
            //todo Post-UT: what if retVal is null? We need to log some kind of exception in that case.

            return(retVal);
        }
Пример #4
0
        public void SetAppState(AppState appState, int?sceneState = null)
        {
            _curAppState     = appState;
            _curLogicHandler = _logicHandlersByAppState[appState];

            if (sceneState.HasValue)
            {
                MenuLogicHandler.DefaultSceneState = sceneState.Value;
            }

            if (appState == AppState.MainMenu)
            {
                ShouldUpdate = false; //we don't want to call _curLogicHandler.OnUpdate() until we've called OnStart() on the new current logic handler.
                GameEngineInterface.LoadScene(Constants.SceneNames.UIScene);
            }
        }