Example #1
0
 public static Debuff Create(Debuff baseInstance, float duration, float intensity) {
   Debuff newInstance = Instantiate(baseInstance);
   newInstance.gameObject.transform.SetParent(GameManager.instance.DebuffHolder);
   newInstance.expiration = Time.time + duration;
   newInstance.intensity = intensity;
   return newInstance;
 }
 public void Start() {
   debuff = GetComponent<Debuff>();
 }
Example #3
0
 public void ApplyDebuff(Debuff debuff, float duration, float intensity) {
   switch (debuff.stackingType) {
     case Debuff.StackingType.DURATION:
       Debuff oldDebuff = debuffs.Find(db => db.GetType() == debuff.GetType());
       if (oldDebuff != null) {
         oldDebuff.expiration += duration;
         Destroy(debuff.gameObject);
       } else {
         debuffs.Add(debuff);
       }
       break;
     case Debuff.StackingType.INTENSITY:
       debuff.intensity = intensity;
       debuffs.Add(debuff);
       break;
   }
 }