private void OnDestroy() { if (CullingGrid.Instance == this) { CullingGrid.Instance = null; } }
private void Awake() { if (CullingGrid.Instance != this) { CullingGrid.Instance = this; this._offset = new Vector3((float)(-(float)this._gridSize / 2 * this._gridWorldSize), 0f, (float)(-(float)this._gridSize / 2 * this._gridWorldSize)); this._rendererGrid = new CullingGrid.Cell[this._gridSize, this._gridSize]; for (int i = 0; i < this._gridSize; i++) { for (int j = 0; j < this._gridSize; j++) { this._rendererGrid[i, j] = new CullingGrid.Cell(); } } this._circlePosition = Vector2.zero; this._circle2Position = Vector2.zero; } }
private void Awake() { if (CullingGrid.Instance != this) { CullingGrid.Instance = this; this._offset = new Vector2((float)(-(float)this._gridSize / 2) * this._gridWorldSize, (float)(-(float)this._gridSize / 2) * this._gridWorldSize); this._rendererGrid = new CullingGrid.Cell[this._gridSize, this._gridSize]; for (int i = 0; i < this._gridSize; i++) { for (int j = 0; j < this._gridSize; j++) { CullingGrid.Cell cell = new CullingGrid.Cell(); cell._cellCenter = this.GridCenterToWorld(i, j); this._rendererGrid[i, j] = cell; } } this._activeCells = new List <CullingGrid.Cell>(); this._workCells = new List <CullingGrid.Cell>(); this._circlePosition = Vector2.zero; } }
private void OnDisable() { CullingGrid.Unregister(this._renderer, this._token); }
private void OnEnable() { this._token = CullingGrid.Register(this._renderer); }