예제 #1
0
        /// <summary>
        /// Change the movement type to the specified type.
        /// </summary>
        /// <param name="type">The type to change the value to.</param>
        private void ChangeMovementType(MovementType type, bool updateSwitcher)
        {
            // Revert the old.
            if (m_ButtonImages[(int)m_MovementType] != null)
            {
                SetButtonColor((int)m_MovementType, m_NormalColor);
            }

            m_MovementType = type;
            SetButtonColor((int)m_MovementType, m_PressedColor);

            // Set the new movement type with the Movement Type Switcher.
            if (updateSwitcher)
            {
                if (IsFirstPersonType(type))
                {
                    m_MovementTypeSwitcher.UpdateMovementType(true, (int)type);
                }
                else
                {
                    m_MovementTypeSwitcher.UpdateMovementType(false, (int)type - 2);
                }
            }

            EnableInput();
            m_PerspectiveSwitchMovementType = MovementType.None;
        }
예제 #2
0
        /// <summary>
        /// Change the movement type to the specified type.
        /// </summary>
        /// <param name="type">The type to change the value to.</param>
        private void ChangeMovementType(MovementType type, bool updateSwitcher)
        {
            // Revert the old.
            UnityEngine.UI.ColorBlock buttonColors;
            if (m_ButtonImages[(int)m_MovementType] != null)
            {
                m_ButtonImages[(int)m_MovementType].color = m_NormalColor;
                buttonColors             = m_Buttons[(int)m_MovementType].colors;
                buttonColors.normalColor = m_NormalColor;
                m_Buttons[(int)m_MovementType].colors = buttonColors;
            }

            m_MovementType = type;
            m_ButtonImages[(int)m_MovementType].color = m_PressedColor;
            buttonColors             = m_Buttons[(int)m_MovementType].colors;
            buttonColors.normalColor = m_PressedColor;
            m_Buttons[(int)m_MovementType].colors = buttonColors;

            // Set the new movement type with the Movement Type Switcher.
            if (updateSwitcher)
            {
                if (IsFirstPersonType(type))
                {
                    m_MovementTypeSwitcher.UpdateMovementType(true, (int)type);
                }
                else
                {
                    m_MovementTypeSwitcher.UpdateMovementType(false, (int)type - 2);
                }
            }

            EnableInput();
            m_PerspectiveSwitchMovementType = MovementType.None;
        }
        /// <summary>
        /// The character has entered from the zone.
        /// </summary>
        /// <param name="characterLocomotion">The character that entered the zone.</param>
        protected override void CharacterEnter(UltimateCharacterLocomotion characterLocomotion)
        {
            // The other collider is the main character.
            m_Character = characterLocomotion.gameObject;
            m_CameraController = UnityEngineUtility.FindCamera(m_Character).GetComponent<CameraController>();

            // The character must have the primary item in order for it to be equipped.
            var inventory = m_Character.GetCachedComponent<InventoryBase>();
            for (int i = 0; i < m_ItemTypes.Length; ++i) {
                if (m_ItemTypes[i] == null) {
                    continue;
                }
                inventory.PickupItemType(m_ItemTypes[i], 1, 0, false, false);
            }

            // Ensure the primary weapon is equipped.
            var equipUnequipAbilities = characterLocomotion.GetAbilities<EquipUnequip>();
            for (int i = 0; i < equipUnequipAbilities.Length; ++i) {
                if (equipUnequipAbilities[i].ItemSetCategoryIndex == m_CategoryIndex) {
                    equipUnequipAbilities[i].StartEquipUnequip(m_ItemSetIndex, true);
                    break;
                }
            }

            // Setup the character for the zone.
            StateManager.SetState(m_Character, "FirstPersonSpringZone", true);
            EventHandler.ExecuteEvent(m_Character, "OnShowUI", false);

            // First person perspective is required...
            m_CameraController.SetPerspective(true);
            // With the combat movement type.
            m_MovementTypeSwitcher.UpdateMovementType(true, (int)MovementTypesZone.MovementType.FirstPersonCombat);
        }