private void generateIndicators(StageCubeData _cubeData, GridZone _zone) { foreach (Vector2Int _coord in _cubeData.cubePlacements) { GameObject _tmp = _pool.getIndicator(); _zone.indicators.Add(_tmp); _tmp.transform.SetParent(_zone.transform); _tmp.transform.rotation = Quaternion.identity; } }
public void SetIndicators(StageCubeData _cubeData, GridZone _zone) { foreach (GameObject item in _zone.indicators) { _pool.retireIndicator(item); } generateIndicators(_cubeData, _zone); for (int i = 0; i < _cubeData.cubePlacements.Length; i++) { _zone.indicators[i].transform.localPosition = _GridController.calculateCoord(_cubeData.cubePlacements[i]); } }
//Compare all cube coordinates by true positions of stage //return true if all cube coordinates match by true positions which means stage completed //else return false which means stage is not completed private bool checkCubeStatus(StageCubeData _cubeData, GridZone _zone) { int _trueCount = 0; foreach (Vector2Int _trueCoord in _cubeData.cubePlacements) { foreach (var _cube in _zone.getMovableCubes()) { if (_trueCoord == _cube.gridCoord) { _trueCount++; } } } if (_trueCount == _cubeData.cubePlacements.Length) { return(true); } else { return(false); } }