public override void OnMouseMovement(int index) { if (index != Selector.index && SelectedNode.unit.attackNodes.Contains(Grid.nodes[index]) && Grid.nodes[index].unit != null && Grid.nodes[index] != SelectedNode) { Selector.MoveTo(Grid.nodes[index].worldPos); Selector.index = index; CombatDatas = CombatManager.Combat(SelectedNode.unit, Grid.nodes[index].unit, bsm); UIManager.forecastUI.SetActive(true); } else { UIManager.forecastUI.SetActive(false); } }
public void AttackCharacter(GameObject attacker, GameObject defender) { Stats attackerStats = attacker.GetComponent <Stats>(); Stats defenderStats = defender.GetComponent <Stats>(); attackerStats.currentActionPoints -= 2; combatManager.Combat(attacker, defender); Animator attackerAnimator = attacker.GetComponent <Animator>(); Animator defenderAnimator = defender.GetComponent <Animator>(); combatAnimationManager.AttackAnimation(attackerAnimator, defenderAnimator); if (defenderStats.currentHealthPoints > 0) { defenderStats.IsAlive = true; } else { defenderStats.IsAlive = false; } }