slimecing

a fighting game featuring slimes and swords
Log | Files | Refs | README

TimedAbilityEffect.cs (795B)


      1 using Slimecing.Characters;
      2 using UnityEngine;
      3 
      4 namespace Slimecing.Abilities.AbilityEffects
      5 {
      6     public abstract class TimedAbilityEffect
      7     {
      8         protected float duration;
      9         protected AbilityUser aUser;
     10         protected Ability ability;
     11 
     12         public bool IsDone => duration <= 0;
     13         
     14         public TimedAbilityEffect(float duration, Ability ability, AbilityUser aUser)
     15         {
     16             this.duration = duration;
     17             this.ability = ability;
     18             this.aUser = aUser;
     19         }
     20 
     21         public void Tick(float delta)
     22         {
     23             duration -= delta;
     24 
     25             if (duration <= 0)
     26             {
     27                 End();
     28             }
     29                 
     30         }
     31 
     32         public abstract void Activate();
     33         public abstract void End();
     34     }
     35 }