using System.Collections; using System.Collections.Generic; using UnityEngine; public class Modifier_Manager : MonoBehaviour { public Player_Manager Player; public List Debuffs = new List(); public float Tickrate; void Start() { ///Add all buffs in the game here Debuffs.Add(new Sluggishness(0.5f)); Debuffs.Add(new ShortSightedness(2.5f)); Debuffs.Add(new Starvation(5)); Debuffs.Add(new Richness(5.0f)); Player = GetComponent(); StartCoroutine(UpdateModifiers()); } // Update is called once per frame IEnumerator UpdateModifiers() //TODO:Get the system to restore regular stats after a certain amount of time { for (; ; ) { foreach (Modifier_Template x in Debuffs) { if (x.ConditionMet(Player)) { x.AttributeChange(Player); } if(!x.ConditionMet(Player)) { x.EndChange(Player); } } yield return new WaitForSeconds(Tickrate); } } }