Exemplo n.º 1
0
        private Point GetRandomDirection(IWorld readonlyWorld)
        {
            var directions = new[] { new Point(1, 0), new Point(-1, 0), new Point(0, 1), new Point(0, -1) }
            .Where(d => !readonlyWorld.GetObjectsAt(Location.Add(d)).Any())
            .Concat(new[] { new Point(0, 0), })
            .ToList();

            return(directions[random.Next(directions.Count)]);
        }
Exemplo n.º 2
0
 public void MoveLocation(Location loc, Direction dir)
 {
     loc.Add(PathFinding.Directions[(int)dir]);
 }
Exemplo n.º 3
0
        public override void Act(IWorld world)
        {
            var destination = GetDirection(world);

            Destination = Location.Add(destination);
        }
Exemplo n.º 4
0
 public void MoveLocation(Location loc, Direction dir)
 {
     loc.Add(PathFinding.Directions[(int)dir]);
 }