예제 #1
0
        private void OnTurnStarted(Selectable obj)
        {
            if (obj.Team != LocalTeam)
            {
                return;
            }

            if (obj is Unit unit)
            {
                var Paths = HexPathfinder.FindAllPaths(unit.Cell, HexType.Empty, unit.Movement);

                var possibleDestinations = Paths.Keys;
                var index        = new Random().Next(0, possibleDestinations.Count - 1);
                var cellToMoveTo = possibleDestinations.ElementAt(index);

                var path = Paths.CalculatePathArray(cellToMoveTo);
                CrossPlayerController.MoveUnit(unit, path, cellToMoveTo);
            }
        }
 public PathfinderDictionary FindAllPathsWhereUnitCanMove(Unit unit)
 {
     return(HexPathfinder.FindAllPaths(unit.Cell, HexType.Empty, unit.Movement));
 }