コード例 #1
0
        public bool PlaceTileEntity(TileEntity tileEntity, long bx, long by)
        {
            var bounds = tileEntity.GetBounds();

            if (!CheckOrMarkBounds(bounds, bx, by))
            {
                return(false);
            }

            tileEntity.ID = idTracker.GetNextID();
            CheckOrMarkBounds(bounds, bx, by, tileEntity.ID);
            tileEntities[tileEntity.ID] = tileEntity;

            // Add tileEntity renderable
            var entity = Core.scene.createEntity($"TIRenderable{tileEntity.ID}");

            entity.addComponent(tileEntity.GenerateRenderable());
            entity.position = new Vector2(bx * Tile.Size, by * Tile.Size);
            return(true);
        }
コード例 #2
0
 public bool CanPlaceTileEntity(TileEntity entity, long bx, long by)
 {
     return(CheckOrMarkBounds(entity.GetBounds(), bx, by));
 }