private void Unstream(int index, GridStreamesrType type) { if (type == GridStreamesrType.Column) { foreach (Layer layer in _mapInfo.Layers) { foreach (int rowIndex in ActiveRowIndex) { if (_mapObjects[rowIndex, index, layer.Index] != null) { GameObject.DestroyImmediate(_mapObjects[rowIndex, index, layer.Index]); } } } } else { foreach (Layer layer in _mapInfo.Layers) { foreach (int columIndex in ActiveColumnIndex) { if (_mapObjects[index, columIndex, layer.Index] != null) { GameObject.DestroyImmediate(_mapObjects[index, columIndex, layer.Index]); } } } } }
public void RemoveActiveIndex(int index, GridStreamesrType type) { if (type == GridStreamesrType.Column) { _activeColumnIndex.Remove(index); Unstream(index, type); } else { _activeRowIndex.Remove(index); Unstream(index, type); } }
private void Stream(int index, GridStreamesrType type) { GameObject loadedObject = null; string objectName; if (type == GridStreamesrType.Column) { foreach (Layer layer in _mapInfo.Layers) { foreach (int rowIndex in ActiveRowIndex) { objectName = layer.RowList[rowIndex].SegmentPregabName[index]; if (_mapObjects[rowIndex, index, layer.Index] == null && layer.RowList[rowIndex].SegmentPregabIndex[index] >= 0) { loadedObject = _mapObjects[rowIndex, index, layer.Index] = LoadMapSegmeentAsset(layer.RowList[rowIndex].SegmentPregabIndex[index]); _mapObjects[rowIndex, index, layer.Index].transform.position = new Vector3(index, rowIndex, layer.Index); loadedObject.transform.SetParent(this._level.transform); } } } } else { foreach (Layer layer in _mapInfo.Layers) { foreach (int columIndex in ActiveColumnIndex) { objectName = layer.RowList[index].SegmentPregabName[columIndex]; if (_mapObjects[index, columIndex, layer.Index] == null && layer.RowList[index].SegmentPregabIndex[columIndex] >= 0) { loadedObject = _mapObjects[index, columIndex, layer.Index] = LoadMapSegmeentAsset(layer.RowList[index].SegmentPregabIndex[columIndex]); _mapObjects[index, columIndex, layer.Index].transform.position = new Vector3(columIndex, index, layer.Index); loadedObject.transform.SetParent(this._level.transform); } } } } }
public void AddActiveIndex(int index, GridStreamesrType type) { if (type == GridStreamesrType.Column) { if (!_activeColumnIndex.Contains(index)) { _activeColumnIndex.Add(index); } Stream(index, type); } else { if (!_activeRowIndex.Contains(index)) { _activeRowIndex.Add(index); } Stream(index, type); } }