Exemple #1
0
        /// <summary>
        /// Transposes camera body into a set offset during travel.
        /// </summary>
        public IEnumerator TransposeCamera(float modifiedY, float modifiedZ)
        {
            float zOffset = 0;
            float yOffset = 0;

            StopCoroutine("TransposeToOrigin");
            StopCoroutine("ShakeCamera");
            StartCoroutine(ShakeCamera());

            //Applies offset when camera is focused
            while (isTransposing && Mathf.Round(zOffset) != modifiedZ)
            {
                //Debug.Log("is increasing");
                zOffset = Mathf.SmoothStep(cameraTransposer.m_FollowOffset.z, modifiedZ, 0.08f);
                yOffset = Mathf.SmoothStep(cameraTransposer.m_FollowOffset.y, modifiedY, 0.01f);
                cameraTransposer.m_FollowOffset = new Vector3(cameraTransposer.m_FollowOffset.x, yOffset, zOffset);
                if (isThrusting)
                {
                    cameraShaker.IncreaseShake(0.07f);
                }
                yield return(null);
            }
        }