public static bool TryPlaceObjectInGrid(string objectID, Vector2Int position, bool overrideBlocks) { if (!BlockDictionary.hasBlock(objectID)) { return(false); } if (!Grid.isOnGrid(position) || position.y < Constants.PROTECTED_ROWS) { return(false); } if (overrideBlocks) { if (!ObjectHasSpaceAt(position, objectID, LevelManager.currentLevel.grid.IDAtPosition(position))) { return(false); } TryDeleteObjectAtPosition(position); } else if (!ObjectHasSpaceAt(position, objectID)) { return(false); } int newID = LevelManager.currentLevel.grid.levelObjects.Count + 1; LevelManager.currentLevel.grid.levelObjects.Add(newID, objectID); LevelGenerator.instance.AddSingleID(position, objectID); return(PaintIDInMap(newID, position, BlockDictionary.instance.getBlock(objectID).GetComponent <BlockManager>().GetDimensions())); }