// Use this for initialization void Start() { AbilityButton = GetComponent <Button>(); Icon = AbilityButton.image; CurrentCooldown = AbilityData.CoolDown; Icon.sprite = AbilityData.Icon; AbilityButton.onClick.AddListener(() => { if (AbilityManager.PlayerClass.PlayerObject.PlayerStats.Resource >= AbilityData.Cost) { AbilityManager.PlayerClass.PlayerObject.PlayerStats.Resource -= AbilityData.Cost; AbilityButton.interactable = false; AbilityData.OnUse(); StartCoroutine(setOnCoolDown()); } else { var tmp = ScriptableObject.CreateInstance <AlertText>(); tmp.AlertDuration = 2; tmp.AlertTextType = AlertTextType.Info; tmp.AlertMessage = "Not Enough " + AbilityManager.PlayerClass.PlayerObject.PlayerStats.ResourcesType.ToString(); AlertManager.AddAlertToQueue(tmp); } }); }