public override IEnumerator DoTurn() { List <Cell> cells = new List <Cell>(); foreach (Cell c in MoveArea) { cells.Add(c); } foreach (Cell c in AttackArea) { cells.Add(c); } FindTarget(cells.ToArray()); if (Target != null) { ChooseWeapon(); yield return(Fighter.ApplyPath(FindPath(), GameSettings.DoMoveAnimation)); TargetData(); if (Target != null && AttackArea.Contains(Map.UnitTile(Target))) { yield return(new UnityEngine.WaitForSeconds(1)); Attack(); } } }
private IEnumerator OnSelectedChange() { ClearDrawnPath(); ClearHighlightedArea(); yield return(StartCoroutine(Fighter.ApplyPath(QPath.FindPath(Fighter, startCell, Selected, Cell.EstimateDistance), GameSettings.DoMoveAnimation))); AttackArea = new Cell[0]; StaffArea = new Cell[0]; if (Fighter.Unit.inventory.GetWeapons(Fighter, true).Length > 0) { Weapon.AttackData atkData = Fighter.Unit.inventory.GetAttackData(Fighter); if (atkData != null) { AttackArea = Map.GetExtendedArea(new Cell[] { Map.UnitTile(Fighter) }, atkData.range, atkData.closedSet, atkData.closedSetMin); } } if (Fighter.Unit.inventory.GetStaves(Fighter, true).Length > 0) { Weapon.AttackData stfData = Fighter.Unit.inventory.GetStaffData(Fighter); if (stfData != null) { StaffArea = Map.GetExtendedArea(new Cell[] { Map.UnitTile(Fighter) }, stfData.range, stfData.closedSet, stfData.closedSetMin); } } CurrentRange = new List <Cell> { Map.GetCellData(Fighter.Position()) }; DoHighlights(Fighter, CurrentRange.ToArray(), false); ActionMenu.Open(Fighter); ActionMenu.ActionDone = false; }