public void Cast() { cooldownTimer = 0f; cooldownMax = cooldown; onCooldown = true; cooldownOverlay.color = new Color32(160, 160, 160, 160); raiderDict = RaiderDB.GetInstance().GetAllRaidersSortedByHealth(); target = raiderDict.First(); if (target != null) { target.Heal(healAmount); } }
/// <summary> /// Called when a cast is sucesfully finished. Heals the numberTargets lowest raiders. /// </summary> public override void OnCastSucess() { List <Raider> raiderDict = RaiderDB.GetInstance().GetAllRaidersSortedByHealth(); if (raiderDict.Count() < numberTargets) //if less raiders are alive than we can target, decrease number of targets { numberTargets = raiderDict.Count(); } for (int i = 0; i < numberTargets; i++) //heal numberTargets raider { Raider target = raiderDict.First(); if (target.IsAlive()) { target.Heal(healAmount); } raiderDict.Remove(target); } }