private IEnumerator Expire() { DisplayEffects(); while (Tick < Duration) { Tick++; yield return(new WaitForSeconds(Turn.ActionThreshold)); } Destroy(Effects, .5f); if (ProtectedTargets[Target] == this) { ProtectedTargets.Remove(Target); // a new casting may have supplanted another } }
private void ProtectTarget() { // The Decider must check Sanctuary.AffectedTargets // TODO: create an intermediate class that manages ongoing spell effects for things like // redirecting attacks. if (ProtectedTargets.ContainsKey(Target)) { ProtectedTargets[Target].Tick = Duration; // time out the existing ienumerator ProtectedTargets[Target] = this; } else { ProtectedTargets[Target] = this; } }