public void TryPlaceTool(Vector2 pos) { if (grid.VectorIsInGrid(pos)) { if (selectedTool is ShipComponent_Room) { if (!LayerPosHasElement(ship.rooms, pos)) { ship.SetRoom(pos, (ShipComponent_Room)selectedTool); Vector2 worldPos = grid.GetWorldPositionFromGrid(pos); GameObject gObject = Instantiate(selectedTool.inner, worldPos, transform.rotation); representation.rooms[(int)pos.x, (int)pos.y] = gObject; gObject.transform.position = worldPos; SetRoomWalls(pos); SetAdjacentRoomWalls(pos); } } else if (selectedTool is ShipComponent_Mechanism) { } else if (selectedTool is ShipComponent_Misc) { if (!LayerPosHasElement(ship.mechanisms, pos) && !) { } } } }