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++; } } }
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)); } } } }
public abstract void Undo(Models.World world);
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))); }
public UndoContext(Models.World world) { this.World = world; }