// Update is called once per frame void Update() { Image image = GetComponent <Image> (); if (this.ability != null && this.ability.abilities [index] != null) { IAbility ability = (IAbility)this.ability.abilities [index]; image.fillAmount = 1 - ((ability.GetCdEnd() - Time.time) / ability.GetCd()); } }