public IWorldCommand Excecute() { ITile tile = level.GetTileAt(posX, posY); if (tile.HasFurniture()) { return(NullCommand.instance); } tile.PlaceFurniture(furniture); return(new RemoveFurnitureCommand(level, posX, posY)); }
public override void Move(int xOffset, int yOffset) { ITile destination = level.GetTileAt(parent.X + xOffset, parent.Y + yOffset); if (destination.HasFurniture() == false) { parent.RemoveFurniture(); destination.PlaceFurniture(this); parent = destination; } OnMove(xOffset, yOffset); }
public IWorldCommand Excecute() { ITile tile = level.GetTileAt(posX, posY); if (tile.HasFurniture() == false) { return(NullCommand.instance); } IFurniture previousFurniture = tile.GetPlacedFurniture(); tile.RemoveFurniture(); return(new PlaceFurnitureCommand(level, posX, posY, previousFurniture)); }