Example #1
0
        /// <summary>
        /// The character has exited from the zone.
        /// </summary>
        /// <param name="characterLocomotion">The character that exited the zone.</param>
        protected override void CharacterExit(UltimateCharacterLocomotion characterLocomotion)
        {
            // The drunk astronaut or giant GameObject may have left the trigger. Set the normal character to the other character's position
            // so when switching back to the normal character they will be in the same position.
            if (characterLocomotion.gameObject != m_Character)
            {
                m_Character.GetComponent <UltimateCharacterLocomotion>().SetPositionAndRotation(characterLocomotion.transform.position, characterLocomotion.transform.rotation);
            }
            // The modern type should activate when leaving the zone.
            ChangeSpringType(SpringType.Modern);

            // Disable the states that were enabled when entering the zone.
            StateManager.SetState(m_Character, "FirstPersonSpringZone", false);
            EventHandler.ExecuteEvent(m_Character, "OnShowUI", true);

            // Ensure the character exited the demo zone.
            m_DemoManager.ExitedTriggerZone(m_DemoZoneTrigger);

            // Restore the other character positions/rotations.
            m_DrunkAstronautCharacter.GetComponent <UltimateCharacterLocomotion>().SetPositionAndRotation(m_DrunkAstronautPosition, m_DrunkAstronautRotation);
            m_GiantCharacter.GetComponent <UltimateCharacterLocomotion>().SetPositionAndRotation(m_GiantPosition, m_GiantRotation);
        }