Ejemplo n.º 1
0
        public IEnumerable <Move> GetAvailableMovementActions(LocationId atLocationId, Models.World world)
        {
            foreach (var paths in AvailablePathsFactory.GetAvailablePaths(atLocationId, world))
            {
                var pathDistance = 1;
                foreach (var path in paths)
                {
                    if (path.Type == Models.PathType.West ||
                        path.Type == Models.PathType.East ||
                        path.Type == Models.PathType.North ||
                        path.Type == Models.PathType.South)
                    {
                        yield return(new Move(Convert(path.Type), pathDistance));
                    }

                    pathDistance++;
                }
            }
        }
Ejemplo n.º 2
0
 public IEnumerable <UsePortal> GetAvailablePortalActions(LocationId atLocationId, Models.World world)
 {
     foreach (var paths in AvailablePathsFactory.GetAvailablePaths(atLocationId, world))
     {
         foreach (var path in paths)
         {
             if (path.Type == Models.PathType.Portal)
             {
                 yield return(new UsePortal(path.Id));
             }
         }
     }
 }
Ejemplo n.º 3
0
 public abstract void Undo(Models.World world);
Ejemplo n.º 4
0
 public abstract void Execute(Models.World world);
        public IEnumerable <ClearObstacle> GetAvailableObstaclesToClear(LocationId atLocationId, Models.ObstacleType obstacleType, Models.World world)
        {
            var connectedPathIds = world.Paths
                                   .Where(path => path.From == atLocationId)
                                   .Select(path => path.Id);

            return(world.Obstacles
                   .Where(obstacle => obstacle.Type == obstacleType && connectedPathIds.Any(pathId => obstacle.BlockedPathIds.Contains(pathId)))
                   .Select(obstacle => new ClearObstacle(obstacle.Id)));
        }
Ejemplo n.º 6
0
 public UndoContext(Models.World world)
 {
     this.World = world;
 }