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

            m_CharacterTransform    = m_Character.transform;
            m_CharacterLocomotion   = m_Character.GetCachedComponent <UltimateCharacterLocomotion>();
            m_CharacterLayerManager = m_Character.GetCachedComponent <CharacterLayerManager>();

            m_MagicItemPerspectiveProperties = m_ActivePerspectiveProperties as IMagicItemPerspectiveProperties;

            DeserializeBeginActions(false);
            DeserializeCastActions(false);
            DeserializeImpactActions(false);
            DeserializeEndActions(false);

            if (m_CastActions != null)
            {
                m_CastActionUsed   = new bool[m_CastActions.Length];
                m_CastActionCasted = new bool[m_CastActions.Length];
            }
            if (m_SurfaceIndicator != null)
            {
                m_SurfaceIndicator.gameObject.SetActive(false);
            }
#if ULTIMATE_CHARACTER_CONTROLLER_MULTIPLAYER
            // The local surface indicator should not show for remote players.
            if (m_NetworkInfo != null && !m_NetworkInfo.IsLocalPlayer())
            {
                m_SurfaceIndicator = null;
            }
#endif
        }
Exemple #2
0
        /// <summary>
        /// The camera perspective between first and third person has changed.
        /// </summary>
        /// <param name="firstPersonPerspective">Is the character in a first person perspective?</param>
        protected override void OnChangePerspectives(bool firstPersonPerspective)
        {
            base.OnChangePerspectives(firstPersonPerspective);

            var targetMagicItemPerspectiveProperties = m_ActivePerspectiveProperties as IMagicItemPerspectiveProperties;
            // The OriginLocation cannot be null.
            if (targetMagicItemPerspectiveProperties.OriginLocation == null) {
                Debug.LogError($"Error: The OriginLocation is null on the {name} MagicItemPerspectiveProperties.");
                return;
            }

            m_MagicItemPerspectiveProperties = targetMagicItemPerspectiveProperties;

            if (m_BeginActions != null) {
                for (int i = 0; i < m_BeginActions.Length; ++i) {
                    m_BeginActions[i].OnChangePerspectives(m_MagicItemPerspectiveProperties.OriginLocation);
                }
            }
            if (m_CastActions != null) {
                for (int i = 0; i < m_CastActions.Length; ++i) {
                    m_CastActions[i].OnChangePerspectives(m_MagicItemPerspectiveProperties.OriginLocation);
                }
            }
            if (m_EndActions != null) {
                for (int i = 0; i < m_EndActions.Length; ++i) {
                    m_EndActions[i].OnChangePerspectives(m_MagicItemPerspectiveProperties.OriginLocation);
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// Initializes any values that require on other components to first initialize.
        /// </summary>
        protected override void Start()
        {
            base.Start();

            if (m_CastActions != null) {
                // Awake is called when the item is ready to go (within start).
                for (int i = 0; i < m_CastActions.Length; ++i) {
                    m_CastActions[i].Awake();
                }
            }

            if (m_MagicItemPerspectiveProperties == null) {
                m_MagicItemPerspectiveProperties = m_ActivePerspectiveProperties as IMagicItemPerspectiveProperties;

                if (m_MagicItemPerspectiveProperties == null) {
                    Debug.LogError($"Error: The First/Third Person Magic Item Properties component cannot be found for the Item {name}." +
                                   $"Ensure the component exists and the component's Action ID matches the Action ID of the Item ({m_ID}).");
                }
            }
        }