private void UnlockAction(Unit unit, int actionIndex) { Units.Actions.Action unitAction = unit.ActionsHandler.GetActions()[actionIndex]; if (!unitAction.AvailableToUnlock || !experiencePointsUpdater.HaveEnoughPoints(unitAction.ExperiencePointsToUnlocked)) { return; } unitAction.CurrentExperiencePoints = unitAction.ExperiencePointsToUnlocked; unitAction.AvailableToUnlock = false; }
private void DisplayActionInfo(Unit unit, Units.Actions.Action action, int index) { this.currentUnit = unit; this.currentAction = action; this.actionIndex = index; if (this.currentAction == null || this.currentUnit == null) { return; } IStringBuilder stringBuilder = new ActionInfoStringBuilder(action); text.text = stringBuilder.GetString(); ShowPanel(true); EnableButton(); purchaseButton?.gameObject.SetActive(!currentAction.IsUnlocked()); }
public static bool ReadyToUnlock(Units.Actions.Action action, int experiencePoints) { return(!action.IsUnlocked() && action.ExperiencePointsToUnlocked <= experiencePoints); }