public void SelectAbility(int abilityID) { currentAbility = abilityID; //set info text Libraries.Ability ability = game.libraries.abilities[abilityID]; string infoString = ability.name + ": " + ability.description + '\n'; infoString += ability.redCost + " red, " + ability.greenCost + " green, " + ability.blueCost + " blue"; abilityInfoText.text = infoString; }
public void CastAbility(int targetID, float powerModifier) { if (currentAbility != 0) //make sure an ability is selected { Libraries.Ability ability = abilities[currentAbility]; if (CheckPlasmids()) //check costs { //subtract costs plasmids[0] -= ability.redCost; plasmids[1] -= ability.greenCost; plasmids[2] -= ability.blueCost; game.CastAbility(targetID, currentAbility, powerModifier); //cast ability UpdatePlasmidText(); } } }
public bool CheckPlasmids() { Libraries.Ability ability = abilities[currentAbility]; return(plasmids[0] >= ability.redCost && plasmids[1] >= ability.greenCost && plasmids[2] >= ability.blueCost); }