예제 #1
0
        /// <summary>
        /// Retrieves the use ability.
        /// </summary>
        public override void OnStart()
        {
            var target = GetDefaultGameObject(m_TargetGameObject.Value);

            if (target != m_PrevTarget)
            {
                m_CharacterLocomotion = target.GetCachedComponent <UltimateCharacterLocomotion>();
                m_LocalLookSource     = target.GetCachedComponent <LocalLookSource>();
                // Find the specified ability.
                var abilities = m_CharacterLocomotion.GetAbilities <Opsive.UltimateCharacterController.Character.Abilities.Items.Use>();
                // The slot ID and action ID must match.
                for (int i = 0; i < abilities.Length; ++i)
                {
                    if (abilities[i].SlotID == m_SlotID.Value && abilities[i].ActionID == m_ActionID.Value)
                    {
                        m_UseAbility = abilities[i];
                        break;
                    }
                }
                if (m_UseAbility == null)
                {
                    Debug.LogWarning("Error: Unable to find a Use ability with slot " + m_SlotID.Value + " and action " + m_ActionID.Value);
                    return;
                }
                m_PrevTarget = target;
            }
            m_WaitForUse = m_WaitForStopUse = false;
        }
예제 #2
0
        /// <summary>
        /// Retrieves the local look source.
        /// </summary>
        public override void OnStart()
        {
            var target = GetDefaultGameObject(m_TargetGameObject.Value);

            if (target != m_PrevTarget)
            {
                m_LocalLookSource = target.GetCachedComponent <LocalLookSource>();
                m_PrevTarget      = target;
            }
        }
예제 #3
0
        /// <summary>
        /// Initializes the default values.
        /// </summary>
        private void Start()
        {
            m_Transform           = transform;
            m_CharacterLocomotion = GetComponent <UltimateCharacterLocomotion>();
            m_AgentMovement       = m_CharacterLocomotion.GetAbility <AgentMovement>();
            m_UseAbility          = m_CharacterLocomotion.GetAbility <Use>();
            m_LocalLookSource     = GetComponent <LocalLookSource>();

            m_AgentMovement.Enabled = false;
            enabled = false;
        }