public void ExecuteAbility() { DeactivatePanel(); AbilityButton.DestroyAll(); TargetButton.DestroyAll(); Unit.ActiveUnit.ExecuteAbility(); }
public void CreateAbilityButtons() { AbilityButton.DestroyAll(); foreach (var ability in Unit.ActiveUnit.abilities) { if (ability.AbilityType == Ability.AbilityTypes.Passive) { continue; } if (ability.TargetingType == Ability.TargetingTypes.Single && Unit.ActiveUnit.EnemiesInLineOfSight().Count == 0) { continue; } var btn = Instantiate(buttonPrefab, buttonPanel.transform); var actionButton = btn.GetComponent <AbilityButton>(); actionButton.OnAbilityButtonClick += _targetPanel.ChangedAbility; actionButton.OnAbilityButtonClick += ChangeAbility; actionButton.SetIcon(ability.Icon); actionButton.AssignAbility(ability); } }