Example #1
0
        private void UpdateGame()
        {
            m_PlayerController.MoveToNextPosition(m_WorldGridController);
            m_ScoreManager.OnPlayerMoved();

            if (m_PlayerController.ActiveNode == m_WorldGridController.PlayerTargetNode)
            {
                m_WorldGridController.UpdatePlayerTarget(m_PlayerController.PathNodes);
                m_PlayerController.IncreaseLength();

                m_CameraController.ShakeCamera(m_CameraController.LightShakeConfiguration);
                m_ScoreManager.OnPlayerReachedTarget();
            }

            m_CameraController.UpdateCameraRotation(m_PlayerController, m_WorldGridController.transform, m_UpdateInterval);
        }
Example #2
0
        private void StartNewGame()
        {
            Debug.Assert(m_WorldGridController == null && m_PlayerController == null, "Game already started!", this);

            m_PlayerController = CreatePlayer();
            if (m_PlayerController != null)
            {
                m_WorldGridController = CreateWorldGrid();
                if (m_WorldGridController != null && m_WorldGridController.GenerateWorldGrid(m_WorldGridGenerator) == true)
                {
                    m_ScoreManager.InitializeScore(m_WorldGridGenerator.PlayerPrefKey);
                    m_ScoreUI.SetIsVisible(true);

                    m_PlayerController.Initialize(m_WorldGridController.PlayerStartNode, m_WorldGridGenerator.PlayerStartDirection);
                    m_WorldGridController.UpdatePlayerTarget(m_PlayerController.PathNodes);

                    m_CameraController.Initialize(m_PlayerController, m_WorldGridController);

                    StartCoroutine(UpdateGameRoutine());
                }
            }
        }