/// <summary> /// Adds an effect to the game object /// </summary> /// <param name="rObject">GameObject to add the effect to</param> protected void AddEffect(GameObject rTarget) { ActorCore lActorCore = rTarget.GetComponent <ActorCore>(); if (lActorCore != null) { LifeCores.ModifyAttribute lEffect = lActorCore.GetActiveEffectFromSourceID <LifeCores.ModifyAttribute>(mNode.ID); if (lEffect != null) { lEffect.Age = 0f; } else { AttributeMessage lMessage = AttributeMessage.Allocate(); lMessage.AttributeID = AttributeID; lMessage.MinAttributeID = MinAttributeID; lMessage.MaxAttributeID = MaxAttributeID; lMessage.Value = UnityEngine.Random.Range(MinValue, MaxValue); lEffect = LifeCores.ModifyAttribute.Allocate(); lEffect.Name = EffectName; lEffect.SourceID = mNode.ID; lEffect.ActorCore = lActorCore; lEffect.ResetOnDeactivate = ResetOnDeactivate; lEffect.Activate(TriggerDelay, MaxAge, lMessage); lActorCore.Effects.Add(lEffect); } } }
/// <summary> /// Adds an effect to the game object /// </summary> /// <param name="rObject">GameObject to add the effect to</param> protected void AddEffect(GameObject rTarget) { ActorCore lActorCore = rTarget.GetComponent <ActorCore>(); if (lActorCore != null) { LifeCores.SpawnParticles lEffect = lActorCore.GetActiveEffectFromSourceID <LifeCores.SpawnParticles>(mNode.ID); if (lEffect != null) { lEffect.Age = 0f; } else { lEffect = LifeCores.SpawnParticles.Allocate(); lEffect.Name = EffectName; lEffect.SourceID = mNode.ID; lEffect.ActorCore = lActorCore; lEffect.Activate(MaxAge, Prefab); lActorCore.Effects.Add(lEffect); } } }
/// <summary> /// Adds an effect to the game object /// </summary> /// <param name="rObject">GameObject to add the effect to</param> protected void AddEffect(GameObject rTarget) { ActorCore lActorCore = rTarget.GetComponent <ActorCore>(); if (lActorCore != null) { LifeCores.CauseDamage lEffect = lActorCore.GetActiveEffectFromSourceID <LifeCores.CauseDamage>(mNode.ID); if (lEffect != null) { lEffect.Age = 0f; } else { // Determine the damage float lDamage = UnityEngine.Random.Range(_MinDamage, _MaxDamage); if (_DamageFloatValueIndex >= 0 && _Spell.Data.FloatValues != null) { lDamage = _Spell.Data.FloatValues[_DamageFloatValueIndex]; } // Setup the message DamageMessage lMessage = DamageMessage.Allocate(); lMessage.DamageType = DamageType; lMessage.ImpactType = ImpactType; lMessage.Damage = lDamage; lMessage.AnimationEnabled = PlayAnimation; lEffect = LifeCores.CauseDamage.Allocate(); lEffect.Name = EffectName; lEffect.SourceID = mNode.ID; lEffect.ActorCore = lActorCore; lEffect.Activate(TriggerDelay, MaxAge, lMessage); lActorCore.Effects.Add(lEffect); } } }