public override void Activate() { if (skillCooldown <= 0) { //Attach the buff to the character BuffInvincible tempMist = gameObject.AddComponent <BuffInvincible>(); tempMist.SetBuffName("Mist"); // Set the name of the buff tempMist.SetBuffTimer(maxBuffTimer); // Set the timer of the buff tempMist.Init(); // Call the init() for the buff class skillCooldown = maxSkillCooldown; } /* * if ((skillCooldown <= 0) && (buffTimer <= 0)) * { * skillCooldown = maxSkillCooldown; * buffTimer = maxBuffTimer; * * transform.tag = "Invincible"; * targetCharacter.color = new Color(1f, 1f, 1f, 0.3f); * }*/ }
public void AddBuff(BaseBuff.BuffType type, float time, float val) { for (int i = 0; i < buffList.Count; i++) { if (buffList[i].GetBuffType() == type) { buffList[i].Reset(time, val); return; } } BaseBuff buff = null; switch (type) { case BaseBuff.BuffType.speed: buff = new BuffSpeed(); break; case BaseBuff.BuffType.invincible: buff = new BuffInvincible(); break; case BaseBuff.BuffType.magent: buff = new BuffMagnet(); break; case BaseBuff.BuffType.scale: buff = new BuffScale(); break; default: Debug.LogError("no buff :" + type); break; } buff.Init(type, time, val); addList.Add(buff); }