/// <summary> /// Used to enable the Agent's purchasing after his cooldown is gone /// </summary> private void Reset(UnitInCd unitInCd) { UnitButton unitButton = unitInCd.unitButton; unitButton.unit.isInCD = false; unitButton.cdFillText.enabled = false; unitButton.cdFillImage.enabled = false; unitsInCD.Remove(unitInCd); UpdateButtons(); }
/// <summary> /// Call when button as been pressed, and set a cooldown on the button /// </summary> public void Cooldown(UnitButton unitButton) { // fill the image to start animation cd unitButton.cdFillImage.fillAmount = 1; unitButton.unit.isInCD = true; UnitInCd unitInCd = new UnitInCd(); unitInCd.unitButton = unitButton; unitInCd.unitCd = unitButton.unit.cDBetweenSpawns; unitsInCD.Add(unitInCd); }