public void RecordStatChange(AbilityPoints abilityPoints, AbilityStat abilityStat, float amount) { this.abilityPoints = abilityPoints; abilityChanges.Add(abilityStat); abilityChangeAmounts.Add(amount); abilityPoints.CurrentPoints--; }
void AlterStat(AbilityStat abilityStat) { if (abilityPoints.CurrentPoints > 0) { float tempChangeAmount = 0; switch (abilityStat.statOperator) { case AbilityStat.StatOperator.Add: tempChangeAmount = ABILITY_INCREMENT_AMOUNT; break; case AbilityStat.StatOperator.Subtract: tempChangeAmount = -ABILITY_INCREMENT_AMOUNT; break; } statPoints.RecordStatChange(abilityPoints, abilityStat, tempChangeAmount); InvokeOnStatChanged(abilityStat, tempChangeAmount); } }
void RegisterStatButtonEvent(GameObject button, AbilityStat stat) { Button statButton = button.GetComponent <Button>(); statButton.onClick.AddListener(() => AlterStat(stat)); }