public void RemoveLevelObject(GridPosition gridPosition, LevelGrid grid) { for (int i = 0; i < LevelGrid.LevelObjects.Count; i++) { if (LevelGrid.LevelObjects[i].transform.position == gridPosition.Position) { grid.ToggleGridPositionUsage(gridPosition); LevelGrid.LevelObjects[i].gameObject.SetActive(false); LevelGrid.LevelObjects.RemoveAt(i); return; } } }
public PlaceLevelObjectCommand(LevelObject levelObject, GridPosition gridPosition, LevelGrid grid) { _levelObject = levelObject; _gridPosition = gridPosition; _grid = grid; _placer = new ObjectPlacer(); }
public void PlaceLeveleObject(LevelObject objectToPlace, GridPosition gridPosition, LevelGrid grid) { grid.ToggleGridPositionUsage(gridPosition); LevelObject placedLevelObject = Instantiate(objectToPlace, gridPosition.Position, Quaternion.identity, grid.transform); LevelGrid.LevelObjects.Add(placedLevelObject); placedLevelObject.gameObject.SetActive(true); }