/// <summary> /// Finish casting the ability, damage units in the ability's area of effect. /// </summary> public override void OnEndCast(object tag, Fury.Behaviors.Unit caster, Fury.Behaviors.Targetable target, UnityEngine.Vector3 position) { // Reduce the caster's energy caster.ModifyEnergy(EnergyType, -EnergyCost); // Iterate through all unfriendly commanders foreach (var cmdr in Fury.Behaviors.Manager.Instance.Commanders) if (!caster.IsTeamOrNeutral(cmdr)) // Iterate through all units of unfriendly commanders foreach (var unit in cmdr.Units.Values) // Check if unit is inside the radius if (Vector3.Distance(unit.transform.position, position) < Radius) { // Damage the unit unit.ModifyHealth(-Damage, caster, this); // Apply status effect if set if (StatusEffect != null) unit.AddStatus(StatusEffect, caster); } // Create an effect where the ability is used if (Effect != null) { var effect = (UnityEngine.GameObject)UnityEngine.GameObject.Instantiate(Effect); effect.transform.position = position; } }
private void PlaceRing(GameObject ring, Fury.Behaviors.Targetable follower) { ring.renderer.enabled = true; ring.transform.parent = follower.transform; ring.renderer.material.color = follower.IsTeamOrNeutral(Owner) ? new Color(0f, 0.5f, 0f) : new Color(1f, 0f, 0f); ring.transform.localPosition = Vector3.up * 0.01f; ring.transform.localRotation = Quaternion.AngleAxis(Time.timeSinceLevelLoad * 30, Vector3.up); ring.transform.localScale = new Vector3(1f / follower.transform.localScale.x, 1f / follower.transform.localScale.y, 1f / follower.transform.localScale.z) * follower.Radius * .2f; }