/// <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); } }
/// <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(); } }
/// <summary> /// Called when the object is selected in the editor /// </summary> private void OnEnable() { // Grab the serialized objects mTarget = (PetCore)target; mTargetSO = new SerializedObject(target); }