Example #1
0
        protected IEnumerator RespawnRoutine()
        {
            // Wait for the animator to be transitioning from the EllenDeath state.
            while (m_CurrentStateInfo.shortNameHash != m_HashEllenDeath || !m_IsAnimatorTransitioning)
            {
                yield return(null);
            }

            // Wait for the screen to fade out.
            yield return(StartCoroutine(ScreenFader.FadeSceneOut()));

            while (ScreenFader.IsFading)
            {
                yield return(null);
            }

            // Enable spawning.
            EllenSpawn spawn = GetComponentInChildren <EllenSpawn>();

            spawn.enabled = true;

            // Get Ellen's health back.
            m_Damageable.ResetDamage();

            // Set the Respawn parameter of the animator.
            m_Animator.SetTrigger(m_HashRespawn);

            // Start the respawn graphic effects.
            spawn.StartEffect();

            // Wait for the screen to fade in.
            // Currently it is not important to yield here but should some changes occur that require waiting until a respawn has finished this will be required.
            yield return(StartCoroutine(ScreenFader.FadeSceneIn()));
        }
Example #2
0
        protected IEnumerator RespawnRoutine()
        {
            // Wait for the animator to be transitioning from the EllenDeath state.
            //等待动画制作者从EllenDeath状态过渡。
            while (m_CurrentStateInfo.shortNameHash != m_HashEllenDeath || !m_IsAnimatorTransitioning)
            {
                yield return(null);
            }

            //等待屏幕淡出。
            // Wait for the screen to fade out.
            yield return(StartCoroutine(ScreenFader.FadeSceneOut()));

            while (ScreenFader.IsFading)
            {
                yield return(null);
            }

            //启用生成。
            // Enable spawning.
            EllenSpawn spawn = GetComponentInChildren <EllenSpawn>();

            spawn.enabled = true;

            //如果有检查点,请将Ellen移到该检查点。
            // If there is a checkpoint, move Ellen to it.
            if (m_CurrentCheckpoint != null)
            {
                transform.position = m_CurrentCheckpoint.transform.position;
                transform.rotation = m_CurrentCheckpoint.transform.rotation;
            }
            else
            {
                Debug.LogError("There is no Checkpoint set, there should always be a checkpoint set. Did you add a checkpoint at the spawn?");
            }

            //设置动画器的Respawn参数。
            // Set the Respawn parameter of the animator.
            m_Animator.SetTrigger(m_HashRespawn);

            //启动重生图形效果。
            // Start the respawn graphic effects.
            spawn.StartEffect();

            // Wait for the screen to fade in.
            // Currently it is not important to yield here but should some changes occur that require waiting until a respawn has finished this will be required.
            //等待屏幕淡入。
            //目前,在此处屈服并不重要,但是如果发生某些更改,需要等到重生完成后,这才是必需的。
            yield return(StartCoroutine(ScreenFader.FadeSceneIn()));

            m_Damageable.ResetDamage();
        }
        protected IEnumerator RespawnRoutine()
        {
            // Wait for the animator to be transitioning from the EllenDeath state.
            while (m_CurrentStateInfo.shortNameHash != m_HashEllenDeath || !m_IsAnimatorTransitioning)
            {
                yield return(null);
            }

            // Enable spawning.
            EllenSpawn spawn = GetComponentInChildren <EllenSpawn>();

            spawn.enabled = true;

            // Set the Respawn parameter of the animator.
            m_Animator.SetTrigger(m_HashRespawn);

            // Start the respawn graphic effects.
            spawn.StartEffect();

            m_Damageable.ResetDamage();
        }
Example #4
0
        public void ReSpawn(int hp, Vector3 postion, Quaternion rotation)
        {
            m_Damageable.currentHitPoints = hp;
            transform.position            = postion;
            transform.rotation            = rotation;
            if (IsMine)
            {
                EllenSpawn spawn = GetComponentInChildren <EllenSpawn>();
                spawn.enabled = true;

                // Get Ellen's health back.
                m_Damageable.ResetDamage();

                // Set the Respawn parameter of the animator.
                m_Animator.SetTrigger(m_HashRespawn);

                // Start the respawn graphic effects.
                spawn.StartEffect();

                // Wait for the screen to fade in.
                // Currently it is not important to yield here but should some changes occur that require waiting until a respawn has finished this will be required.
                StartCoroutine(ScreenFader.FadeSceneIn());
            }
        }