Exemplo n.º 1
0
 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;
         }
     }
 }
Exemplo n.º 2
0
        public PlaceLevelObjectCommand(LevelObject levelObject, GridPosition gridPosition, LevelGrid grid)
        {
            _levelObject  = levelObject;
            _gridPosition = gridPosition;
            _grid         = grid;

            _placer = new ObjectPlacer();
        }
Exemplo n.º 3
0
        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);
        }