예제 #1
0
        /// <summary>
        /// Called when the action is first activated
        /// <param name="rPreviousSpellActionState">State of the action prior to this one activating</param>
        public override void Activate(int rPreviousSpellActionState = -1, object rData = null)
        {
            mIsShuttingDown = false;

            base.Activate(rPreviousSpellActionState, rData);

            if (mInstances != null && mInstances.Count > 0)
            {
                if (_Spell.ShowDebug)
                {
                    for (int i = 0; i < mInstances.Count; i++)
                    {
                        mInstances[i].hideFlags = HideFlags.None;
                    }
                }

                mPetCore = mInstances[0].GetComponent <PetCore>();
                if (mPetCore != null)
                {
                    mPetCore.Age = 0f;

                    if (MaxAge > 0f && _DeactivationIndex == EnumSpellActionDeactivation.TIMER)
                    {
                        mPetCore.MaxAge = MaxAge;
                    }

                    mPetCore.Prefab          = _Prefab;
                    mPetCore.Anchor          = mTarget;
                    mPetCore.AnchorOffset    = (mTarget != null ? mTarget.InverseTransformPoint(mInstances[0].transform.position) : mTargetPosition);
                    mPetCore.OnReleasedEvent = OnCoreReleased;
                    mPetCore.Play();
                }
            }

            // If there were no particles, stop
            if (mInstances[0] == null || mParticleCores == null)
            {
                Deactivate();
            }
        }