Ejemplo n.º 1
0
        private HighAction collectAction(LegacyMap map, IPlayer player)
        {
            Point playerPosition = player.Position;

            for (int edge = 1; edge < map.tileTypeMap.GetLength(0); edge++)
            {
                for (int i = player.HouseLocation.X - edge; i <= player.HouseLocation.X + edge && i >= 0 && i < map.tileTypeMap.GetLength(0); i++)
                {
                    for (int j = player.HouseLocation.Y - edge; j <= player.HouseLocation.Y + edge && j >= 0 && j < map.tileTypeMap.GetLength(1); j++)
                    {
                        if (map.tileTypeMap[i, j] == TileContent.Resource)
                        {
                            Point target = new Point(i, j);
                            if (Point.DistanceManhatan(target, playerPosition) <= 1)
                            {
                                return(new Collect(target));
                            }
                            else
                            {
                                return(MultipleActions.MoveThenCollect(player, map, target));
                            }
                        }
                    }
                }
            }
            return(returnHomeAction(map, player));
        }
Ejemplo n.º 2
0
 public HighAction NextAction(LegacyMap map, IPlayer player)
 {
     if (player.CarriedResources < player.CarryingCapacity)
     {
         return(collectAction(map, player));
     }
     else
     {
         return(returnHomeAction(map, player));
     }
 }
Ejemplo n.º 3
0
 private HighAction exploreAction(LegacyMap map, IPlayer gameInfo)
 {
     return(null);
 }
Ejemplo n.º 4
0
 private HighAction KillPlayer(LegacyMap map, GameInfo gameInfo)
 {
     return(null);
 }
Ejemplo n.º 5
0
 private HighAction DefendSelf(LegacyMap map, IPlayer player)
 {
     return(null);
 }
Ejemplo n.º 6
0
 private HighAction DefendHome(LegacyMap map, GameInfo gameInfo)
 {
     return(null);
 }
Ejemplo n.º 7
0
 private HighAction returnHomeAction(LegacyMap map, IPlayer player)
 {
     return(new Move(player, map, player.HouseLocation));
 }