コード例 #1
0
        /// <summary>
        /// Checks if game is over.  If so, moves camera to birds-eye-view position.
        /// </summary>
        /// <returns></returns>
        private IEnumerator CheckIfPlayerDead()
        {
            GameState gameState = GetGlobalObjects.getGameState();

            if (gameState.getGameOver() && !inBirdsEyeView)
            {
                // Adjust the camera to bird's-eye view
                goToBirdsEyeView();
                Debug.Log("BIRD EYE VIEW");
                yield return(new WaitForSeconds(10));
                //Application.Quit();
            }
        }
コード例 #2
0
        // we want to use LateUpdate() because it is always executed after all the other Update()'s called on this frame.
        // Since this is a follow camera, we want to follow the updated movements
        void LateUpdate()
        {
            if (!GetGlobalObjects.getGameState().getGameOver())
            {
                // Follow the player's transform
                transform.position =
                    (player.transform.position - player.transform.forward * CameraConstants.STANDARD_CAMERA_DISTANCE_MULT) +
                    CameraConstants.STANDARD_CAMERA_HEIGHT;

                // Follow the player's forward direction
                transform.LookAt(player.transform.position);
            }
            StartCoroutine(CheckIfPlayerDead());
        }