Exemplo n.º 1
0
 public void ExecuteAbility()
 {
     DeactivatePanel();
     AbilityButton.DestroyAll();
     TargetButton.DestroyAll();
     Unit.ActiveUnit.ExecuteAbility();
 }
Exemplo n.º 2
0
 public void ChangedAbility(object sender, AbilityButton.OnAbilityButtonClickArgs e)
 {
     if (e.SelectedAbility.TargetingType == Single)
     {
         if (!Unit.ActiveUnit.targetUnit)
         {
             Unit.ActiveUnit.targetUnit = Unit.ActiveUnit.EnemiesInLineOfSight()[0];
         }
         UpdateTargetPanel();
     }
     else
     {
         TargetButton.DestroyAll();
     }
 }
Exemplo n.º 3
0
 public void UpdateTargetPanel()
 {
     TargetButton.DestroyAll();
     foreach (var unit in Unit.ActiveUnit.EnemiesInLineOfSight())
     {
         var btn          = Instantiate(targetButtonPrefab, transform);
         var targetButton = btn.GetComponent <TargetButton>();
         targetButton.targetUnit = unit;
         if (Unit.ActiveUnit.targetUnit == unit)
         {
             targetButton.TargetSelected();
         }
         if (Unit.ActiveUnit.selectedAbility == null)
         {
             Unit.ActiveUnit.selectedAbility = Unit.ActiveUnit.abilities[0];
         }
         var hitChance = CombatHitCalc.CalculateHitChance(Unit.ActiveUnit, unit, Unit.ActiveUnit.selectedAbility)["HIT"];
         targetButton.SetHitChance(hitChance * 100);
         targetButton.OnTargetButtonClick += ChangeTarget;
         targetButton.OnTargetButtonClick += _abilityPanel.ChangedTarget;
     }
 }