Beispiel #1
0
        /// <summary>
        /// Initialize the default values.
        /// </summary>
        protected override void Awake()
        {
            base.Awake();

            // The item may have been added at runtime in which case the look source has already been populated.
            var characterLocomotion = m_Character.GetCachedComponent <UltimateCharacterLocomotion>();

            m_LookSource = characterLocomotion.LookSource;

            m_UseAnimatorAudioStateSet.DeserializeAnimatorAudioStateSelector(m_Item, characterLocomotion);
            m_UseAnimatorAudioStateSet.Awake(m_Item.gameObject);

            m_AttributeManager = GetComponent <AttributeManager>();
            if (m_AttributeManager != null)
            {
                m_UseAttribute = m_AttributeManager.GetAttribute(m_UseAttributeName);

                if (m_UseAttribute != null)
                {
                    EventHandler.RegisterEvent(m_UseAttribute, "OnAttributeReachedDestinationValue", UseDepleted);
                }
            }
            m_CharacterUseAttributeManager = m_Character.GetCachedComponent <AttributeManager>();
            if (m_CharacterUseAttributeManager != null)
            {
                m_CharacterUseAttribute = m_CharacterUseAttributeManager.GetAttribute(m_CharacterUseAttributeName);
            }

            m_NextAllowedUseTime = Time.time;
            EventHandler.RegisterEvent <ILookSource>(m_Character, "OnCharacterAttachLookSource", OnAttachLookSource);
        }
Beispiel #2
0
        /// <summary>
        /// Initialize the default values.
        /// </summary>
        protected override void Awake()
        {
            base.Awake();

            m_AttributeManager = GetComponent <AttributeManager>();
            if (!string.IsNullOrEmpty(m_DurabilityAttributeName))
            {
                if (m_AttributeManager == null)
                {
                    Debug.LogError("Error: The shield " + m_GameObject.name + " has a durability attribute specified but no Attribute Manager component.");
                }
                else
                {
                    m_DurabilityAttribute = m_AttributeManager.GetAttribute(m_DurabilityAttributeName);

                    if (m_DurabilityAttribute != null)
                    {
                        EventHandler.RegisterEvent(m_DurabilityAttribute, "OnAttributeReachedDestinationValue", DurabilityDepleted);
                    }
                }
            }

            m_ImpactAnimatorAudioStateSet.DeserializeAnimatorAudioStateSelector(m_Item, m_Character.GetCachedComponent <UltimateCharacterLocomotion>());
            m_ImpactAnimatorAudioStateSet.Awake(m_Item.gameObject);
            EventHandler.RegisterEvent <bool, bool>(m_Character, "OnAimAbilityStart", OnAim);
        }