public void RemoveBuff(Buff buff) { Debug.Log("Removed " + buff); currentBuffs[buff] -= 1; if (currentBuffs[buff] == 0) { si.DecreaseLevel(); //Remove visuals: if (buff == Buff.Bleeding) { //Remove bleeding visual } else if (buff == Buff.Slowed) { //Remove slowed visual } else if (buff == Buff.Dysentery) { //Remove dysentery visual } else if (buff == Buff.Confusion) { //Remove dysentery visual FlipControls(); confusionVisual.SetActive(false); } } FloatingBuff popup = Instantiate(_popup, _popupTransform).GetComponent <FloatingBuff>(); //Notify player and do stuff if (buff == Buff.Bleeding) { popup.SetSprites(_debuffs[0], _operations[1]); } else if (buff == Buff.Slowed) { popup.SetSprites(_debuffs[1], _operations[1]); } else if (buff == Buff.Dysentery) { popup.SetSprites(_debuffs[2], _operations[1]); } else if (buff == Buff.Confusion) { popup.SetSprites(_debuffs[3], _operations[1]); } else if (buff == Buff.Weakness) { popup.SetSprites(_debuffs[4], _operations[1]); } DC.SetBuff(buff, currentBuffs[buff], false); //Update stats: if (buff == Buff.Slowed && currentBuffs[Buff.Slowed] < 10) { _speed /= 0.93f; } else if (buff == Buff.Weakness && currentBuffs[Buff.Slowed] < 5) { _damage /= 0.9f; } //Update UI or whatever }
public void AddBuff(Buff buff) { Debug.Log("Added " + buff); currentBuffs[buff] += 1; //Only for new buff if (currentBuffs[buff] == 1) { si.IncreaseLevel(); //Add visuals: if (buff == Buff.Bleeding) { //Add bleeding visual } else if (buff == Buff.Slowed) { //Add slowed visual } else if (buff == Buff.Dysentery) { //Add dysentery visual } else if (buff == Buff.Confusion) { FlipControls(); //Add dysentery visual confusionVisual.SetActive(true); } else if (buff == Buff.Weakness) { //weakness; } } //For first AND existing buffs FloatingBuff popup = Instantiate(_popup, _popupTransform).GetComponent <FloatingBuff>(); //Notify player & do other stuff if (buff == Buff.Bleeding) { popup.SetSprites(_debuffs[0], _operations[0]); bleedingTimeoutCounter = bleedingTimeoutCounterMax; } else if (buff == Buff.Slowed) { popup.SetSprites(_debuffs[1], _operations[0]); } else if (buff == Buff.Dysentery) { popup.SetSprites(_debuffs[2], _operations[0]); } else if (buff == Buff.Confusion) { popup.SetSprites(_debuffs[3], _operations[0]); confusionTimeoutCounter = confusionTimeoutCounterMax; } else if (buff == Buff.Weakness) { popup.SetSprites(_debuffs[4], _operations[0]); } //Update stats: if (buff == Buff.Slowed && currentBuffs[Buff.Slowed] <= 10) { _speed *= 0.93f; } else if (buff == Buff.Weakness && currentBuffs[Buff.Slowed] < 5) { _damage /= 0.9f; } //Update UI or whatever DC.SetBuff(buff, currentBuffs[buff], true); }