public GameObject getAbilityObject(AbilityNames _AbilityName) { GameObject _abilityObject = null; for (int i = 0; i < resource_AllAbilityObjects.Length; i++) { if (resource_AllAbilityObjects[i].name == _AbilityName.ToString()) { _abilityObject = resource_AllAbilityObjects[i]; } } return(_abilityObject); }
public void startCasting(AbilityNames _abilityName) { // THIS FUNCTION DOES NOT INSTANTIATE ANY GAMEOBJECT. abilityCastingTimerOverlay.SetActive(true); // Lets player have a visual on its casting time. GameObject _abilityObject = getAbilityObject(_abilityName); // gets the ability object/ AbilityStats currentAbilityStat = _abilityObject.GetComponent <AbilityStats>(); fillImage = abilityCastingTimerOverlay.transform.GetChild(0).GetComponent <Image>(); // fill image is in the order of the child number indicated in code. abilityNameTxt = abilityCastingTimerOverlay.transform.GetChild(1).GetComponent <Text>(); abilityCastingTime = currentAbilityStat.castingTime; // Sets the fillImage.fillAmount = 0; abilityNameTxt.text = _abilityName.ToString(); }