예제 #1
0
        /// <summary>
        /// Called when the selector has finished selecting
        /// </summary>
        /// <param name="rCore"></param>
        /// <param name="rUserData"></param>
        private void OnSelected(ILifeCore rCore, object rUserData = null)
        {
            Transform lTarget = null;

            if (rCore is SelectTargetCore)
            {
                lTarget = ((SelectTargetCore)rCore).SelectedTarget;
            }

            if (lTarget != null)
            {
                // Determine if we're done choosing a target
                if (_Spell.Data.Targets == null)
                {
                    _Spell.Data.Targets = new List <GameObject>();
                }
                _Spell.Data.Targets.Clear();

                _Spell.Data.Targets.Add(lTarget.gameObject);

                // Flag the action as done
                State           = EnumSpellActionState.SUCCEEDED;
                mIsShuttingDown = true;
                //OnSuccess();
            }
            else
            {
                OnFailure();
            }
        }
예제 #2
0
        /// <summary>
        /// Called when the projectile impacts something
        /// </summary>
        /// <param name="rCore">The life core that raised the event</param>
        /// <param name="rUserData">User data returned</param>
        private void OnImpact(ILifeCore rCore, object rUserData = null)
        {
            Combat.CombatHit lHitInfo = (Combat.CombatHit)rUserData;

            // Fill the data with the target information
            SpellData lData = _Spell.Data;

            if (lData.Targets == null)
            {
                lData.Targets = new List <GameObject>();
            }
            lData.Targets.Add(lHitInfo.Collider.gameObject);

            if (lData.Positions == null)
            {
                lData.Positions = new List <Vector3>();
            }
            lData.Positions.Add(lHitInfo.Point);

            if (lData.Forwards == null)
            {
                lData.Forwards = new List <Vector3>();
            }
            if (_Spell.Owner != null)
            {
                lData.Forwards.Add(_Spell.Owner.transform.forward);
            }

            mIsShuttingDown = true;
            State           = EnumSpellActionState.SUCCEEDED;
        }
예제 #3
0
        /// <summary>
        /// Called when the particle core has finished running and is released
        /// </summary>
        /// <param name="rCore"></param>
        private void OnParticleCoreReleased(ILifeCore rCore, object rUserData = null)
        {
            if (mParticleCore != null)
            {
                mParticleCore.OnReleasedEvent = null;
                mParticleCore = null;
            }

            base.Deactivate();
        }
예제 #4
0
        /// <summary>
        /// Called when the core has finished running and is released
        /// </summary>
        /// <param name="rCore"></param>
        protected override void OnCoreReleased(ILifeCore rCore, object rUserData = null)
        {
            if (object.ReferenceEquals(rCore, mPetCore))
            {
                mPetCore.OnReleasedEvent = null;
                mPetCore = null;

                base.OnCoreReleased(rCore, rUserData);
            }
        }
예제 #5
0
        /// <summary>
        /// Called when the core has finished running and is released
        /// </summary>
        /// <param name="rCore">The life core that raised the event</param>
        /// <param name="rUserData">User data returned</param>
        private void OnCoreReleased(ILifeCore rCore, object rUserData = null)
        {
            if (mProjectileCore != null)
            {
                mProjectileCore.Owner           = null;
                mProjectileCore.OnReleasedEvent = null;
                mProjectileCore.OnImpactEvent   = null;
                mProjectileCore.OnExpiredEvent  = null;
                mProjectileCore = null;
            }

            base.Deactivate();
        }
예제 #6
0
        /// <summary>
        /// Called when the projectile expires without impacting anything
        /// </summary>
        /// <param name="rCore">The life core that raised the event</param>
        /// <param name="rUserData">User data returned</param>
        private void OnExpired(ILifeCore rCore, object rUserData = null)
        {
            mIsShuttingDown = true;

            if (SucceedOnExpire)
            {
                State = EnumSpellActionState.SUCCEEDED;
            }
            else
            {
                State = EnumSpellActionState.FAILED;
            }
        }
예제 #7
0
        /// <summary>
        /// Called when the core has finished running and is released
        /// </summary>
        /// <param name="rCore"></param>
        protected virtual void OnCoreReleased(ILifeCore rCore, object rUserData = null)
        {
            ParticleCore lParticleCore = rCore as ParticleCore;

            if (lParticleCore != null && mParticleCores != null)
            {
                mParticleCores.Remove(lParticleCore);
            }

            if (mParticleCores == null || mParticleCores.Count == 0)
            {
                base.Deactivate();
            }
        }
예제 #8
0
 /// <summary>
 /// Raised when a collider exits the trigger area
 /// </summary>
 /// <param name="rArea">Area core that was entered</param>
 /// <param name="rCollider">Collider who entered</param>
 private void OnAreaExit(ILifeCore rArea, object rCollider)
 {
     // Check if we should force a node link to activate
     if (mNode != null && _OnTriggerExitTag.Length > 0)
     {
         for (int i = 0; i < mNode.Links.Count; i++)
         {
             if (mNode.Links[i].TestActivate(_OnTriggerExitTag))
             {
                 _Spell.ActivateLink(mNode.Links[i], rCollider);
             }
         }
     }
 }
예제 #9
0
        /// <summary>
        /// Called when the core has finished running and is released
        /// </summary>
        /// <param name="rCore"></param>
        private void OnCoreReleased(ILifeCore rCore, object rUserData = null)
        {
            TriggerAreaCore lTriggerAreaCore = rCore as TriggerAreaCore;

            if (lTriggerAreaCore != null && lTriggerAreaCore != null)
            {
                mTriggerAreaCores.Remove(lTriggerAreaCore);
            }

            if (mTriggerAreaCores == null || mTriggerAreaCores.Count == 0)
            {
                base.Deactivate();
            }

            base.Deactivate();
        }
예제 #10
0
        /// <summary>
        /// Called when the selector has finished selecting
        /// </summary>
        /// <param name="rCore"></param>
        /// <param name="rUserData"></param>
        private void OnSelected(ILifeCore rCore, object rUserData = null)
        {
            Vector3 lPosition = Vector3Ext.Null;
            Vector3 lForward  = Vector3Ext.Null;

            if (mProjector != null)
            {
                lPosition = mPosition;
                lForward  = mForward;
            }
            else if (rCore is SelectPositionCore)
            {
                lPosition = ((SelectPositionCore)rCore).SelectedPosition;
                lForward  = ((SelectPositionCore)rCore).SelectedForward;
            }

            // Determine if we have a valid position
            if (lPosition != Vector3Ext.Null)
            {
                // Determine if we're done choosing a point
                if (_Spell.Data.Positions == null)
                {
                    _Spell.Data.Positions = new List <Vector3>();
                }
                _Spell.Data.Positions.Clear();

                _Spell.Data.Positions.Add(lPosition);

                if (_Spell.Data.Forwards == null)
                {
                    _Spell.Data.Forwards = new List <Vector3>();
                }
                _Spell.Data.Forwards.Clear();

                _Spell.Data.Forwards.Add(lForward);

                // Flag the action as done
                State           = EnumSpellActionState.SUCCEEDED;
                mIsShuttingDown = true;
                //OnSuccess();
            }
            else
            {
                OnFailure();
            }
        }
예제 #11
0
        /// <summary>
        /// Raised when a collider stays the trigger area
        /// </summary>
        /// <param name="rArea">Area core that was entered</param>
        /// <param name="rCollider">Collider who entered</param>
        private void OnAreaStay(ILifeCore rArea, object rCollider)
        {
            if (mIsShuttingDown)
            {
                return;
            }

            // Check if we should force a node link to activate
            if (mNode != null && _OnTriggerStayTag.Length > 0)
            {
                for (int i = 0; i < mNode.Links.Count; i++)
                {
                    if (mNode.Links[i].TestActivate(_OnTriggerStayTag))
                    {
                        _Spell.ActivateLink(mNode.Links[i], rCollider);
                    }
                }
            }
        }
예제 #12
0
        /// <summary>
        /// Called when the core has finished running and is released
        /// </summary>
        /// <param name="rCore"></param>
        private void OnCoreReleased(ILifeCore rCore, object rUserData = null)
        {
            if (mSelectorCore != null)
            {
                mSelectorCore.Owner           = null;
                mSelectorCore.InputSource     = null;
                mSelectorCore.OnSelectedEvent = null;
                mSelectorCore.OnReleasedEvent = null;
                mSelectorCore = null;
            }

            // If our state isn't set to succes (meaning we have something)
            // we are going to flag this node as a failure
            if (State != EnumSpellActionState.SUCCEEDED)
            {
                State = EnumSpellActionState.FAILED;
            }

            base.Deactivate();
        }
예제 #13
0
 /// <summary>
 /// Notification that the bubbles have been destroyed
 /// </summary>
 /// <param name="rRipples"></param>
 public void OnUnderwaterReleased(ILifeCore rCore, object rUserData = null)
 {
     mUnderwaterCore = null;
 }
예제 #14
0
 /// <summary>
 /// Notification that the ripples have been destroyed
 /// </summary>
 /// <param name="rRipples"></param>
 public void OnRipplesReleased(ILifeCore rCore, object rUserData = null)
 {
     mRipplesCore = null;
 }
예제 #15
0
 /// <summary>
 /// Called when the selector has finished selecting
 /// </summary>
 /// <param name="rCore"></param>
 /// <param name="rUserData"></param>
 private void OnCancelled(ILifeCore rCore, object rUserData = null)
 {
     State           = EnumSpellActionState.FAILED;
     mIsShuttingDown = true;
 }