public void Index(IPlaceable obj, Position position) { }
/// <summary> /// Sets up the follow camera /// </summary> /// <param name="target">Initial target</param> public FollowCamera( IPlaceable target ) { m_Target = target; }
public bool Remove(IPlaceable placeable) { return(true); }
public bool Move(IPlaceable placeable, Position position) { return(true); }
public Position GetPosition(IPlaceable placeable) { return(null); }
public bool Place(IPlaceable placeable, int x, int y) { return(Place(placeable, new Position2D(x, y))); }
public void Draw(SpriteBatch sb, Camera cam, RenderTarget2D interiorScene) { // Draw the tileset Vector2 minCorner = new Vector2(cam.Position.X - (GameOptions.PrefferedBackBufferWidth / 2), cam.Position.Y - (GameOptions.PrefferedBackBufferHeight / 2)); Vector2 maxCorner = new Vector2(cam.Position.X + (GameOptions.PrefferedBackBufferWidth / 2), cam.Position.Y + (GameOptions.PrefferedBackBufferHeight / 2)); // setup drawing for interior on backbuffer _graphics.SetRenderTarget(interiorScene); _graphics.Clear(Color.Black); startDrawPoint = new Vector2(interiorForObj.location.X - (width / 2), interiorForObj.location.Y - (height / 2)); Vector2 drawPoint = startDrawPoint; interiorTiles.Clear(); for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { TilePiece tile = interiorMap[((cols) * i) + j]; if (tile == null) { drawPoint.X += GameOptions.tileWidth * 2; continue; } tile.location = drawPoint; var loc = tile.location; tile.location += speed; tile.inInteriorId = interiorId; // TODO: need to move setting of InteriorId to constructor, but this screws up serialization interiorTiles.Add(tile); if (tile.groundObjects != null) { foreach (var groundObject in tile.groundObjects) { groundObject.location = loc; } } // draw if in viewporit if ((loc.X >= minCorner.X && loc.X <= maxCorner.X) && (loc.Y >= minCorner.Y && loc.Y <= maxCorner.Y)) { tile.Draw(sb, cam); } drawPoint.X += GameOptions.tileWidth * 2; } drawPoint.Y += GameOptions.tileHeight * 2; drawPoint.X = startDrawPoint.X; } // reset these menu trackers showCraftingMenu = false; showStorageMenu = false; craftObj = null; invStorage = null; List <Sprite> drawOrder = interiorObjects.ToList(); drawOrder.Sort((a, b) => a.GetBoundingBox().Bottom.CompareTo(b.GetBoundingBox().Bottom)); // Draw any interior objs foreach (var obj in drawOrder) { // npcs always have random loc set when entering interior, other objects are randomly set initially, unless coming from a save if ((!tilesSet && !(obj is IPlayer) && !interiorWasLoaded) || (obj is INPC && !showingInterior)) { obj.location = RandomInteriorTile().location; } // special draw for player if (obj is IPlayer) { DrawUtility.DrawPlayer(sb, cam, (PiratePlayer)obj); continue; } obj.Draw(sb, cam); if (obj is IVulnerable) { IVulnerable v = (IVulnerable)obj; v.DrawHealthBar(sb, cam); } if (obj is IInventoryItem) { InventoryItem item = (InventoryItem)obj; if (!item.inInventory) { item.DrawPickUp(sb, cam); } } if (obj is IPlaceable) { IPlaceable placeObj = (IPlaceable)obj; placeObj.DrawCanPickUp(sb, cam); } if (obj is ICraftingObject) { ICraftingObject tcraftObj = (ICraftingObject)obj; tcraftObj.DrawCanCraft(sb, cam); if (tcraftObj.GetShowMenu()) { showCraftingMenu = true; craftObj = tcraftObj; } } if (obj is IStorage) { Storage storage = (Storage)obj; storage.DrawOpenStorage(sb, cam); if (storage.storageOpen) { showStorageMenu = true; invStorage = storage; } } } tilesSet = true; showingInterior = true; }
public WallDecorator(IPlaceable placeable) { _placeable = placeable; }
public bool CanColocate(IPlaceable placeable) { return(true); }
public HallGenerator(IPlaceable wall, IPlaceable floor, Source <GenerationContext, IRoomGenerator> endPossibilities) { _wall = wall; _floor = floor; _endPossibilities = endPossibilities; }
/// <summary> /// Removes a placeable from the map. /// </summary> /// <param name="placeable"> Placeable to remove </param> public void RemoveBuilding(IPlaceable <Building> placeable) { buildingsData.Remove(placeable); placeable.PrepareRemoval(); Destroy(placeable.GetObject()); }
public bool IsPlaceable(IPlaceable <T> building, Vector2Int pos) => IsPlaceable(CalculatePositionWithOffset(building.GetOffsetPositions(), pos));
public RectCompositeRoomGenerator(int minRects, int maxRects, Rectangle minBounds, Rectangle maxBounds, IPlaceable wall, IPlaceable floor) { MinRects = minRects; MaxRects = maxRects; MinBounds = minBounds; MaxBounds = maxBounds; _wall = wall; _floor = floor; Decorators = new PrioritySource <GenerationContext, IAreaDecorator>(true); NeighborPossibilities = new PrioritySource <GenerationContext, IRoomGenerator>(true); }