private void CheckForEffectedTargetsAndApplyEffects(AuraTrackingInfo ax) { List <AbilityEffectReceiver> things = new List <AbilityEffectReceiver>(); Collider[] hits = Physics.OverlapSphere(myTransform.position, ax.aura.auraRadius); if (hits.Length > 0) { Debug.Log(hits.Length); foreach (var x in hits) { //When aura finds itself in overlap sphere, check whether or not it should apply to the caster if (x.gameObject == this.gameObject && !ax.aura.doesEffectSelf) { continue; } var abilityReceiver = x.gameObject.GetComponent <AbilityEffectReceiver>(); if (abilityReceiver != null) { ApplyAllEffectsToTarget(abilityReceiver, ax.aura.auraEffects); if (ax.aura.doesPulse) //Reset pulse activation time { ax.nextPulseActivationTime = Time.time + ax.aura.pulseDelay; } } } } }
public void GenerateAura(AuraAbility auraInfo) { var newAura = new AuraTrackingInfo() { aura = auraInfo, nextPulseActivationTime = auraInfo.doesPulse ? Time.time + auraInfo.pulseDelay : Mathf.Infinity, endTime = Time.time + auraInfo.auraDuration }; activeAuras.Add(newAura); if (auraInfo.vfx != null) { var effect = Instantiate(auraInfo.vfx, myTransform); Destroy(effect, auraInfo.auraDuration); } Debug.Log($"Generated aura for ability: {newAura.aura.abilityName}"); }