Ejemplo n.º 1
0
 public override void UnregisterEffect(Creature target)
 {
     for (int i = 0; i < target.activeTimedProtections.Count; i++)
     {
         TimedProtectionContainer container = target.activeTimedProtections [i];
         if (container.protection == this)
         {
             target.activeTimedProtections.Remove(container);
         }
     }
     Debug.Log("unregister protection: " + this.name);
     EffectController.instance.RecalculateProtections(target);
 }
Ejemplo n.º 2
0
        private IEnumerator ApplyTimedProtection(Creature target, TimedProtectionContainer container)
        {
            TimedProtection protection = container.protection as TimedProtection;
            float           startTime  = Time.time + protection.timeToStart;
            float           endTime    = Time.time + protection.timeToStart + protection.duration;

            while (Time.time < startTime)
            {
                yield return(null);
            }

            protection.Perform(target);

            while (Time.time <= endTime)
            {
                endTime = startTime + container.timeToEnd;
                yield return(null);
            }
            protection.UnregisterEffect(target);
        }
Ejemplo n.º 3
0
 public void StartTimedProtection(Creature target, TimedProtectionContainer protectionContainer)
 {
     StartCoroutine(ApplyTimedProtection(target, protectionContainer));
 }