示例#1
0
 private void OnDestroy()
 {
     if (CullingGrid.Instance == this)
     {
         CullingGrid.Instance = null;
     }
 }
示例#2
0
 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;
     }
 }
示例#3
0
 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;
     }
 }
示例#4
0
 private void OnDisable()
 {
     CullingGrid.Unregister(this._renderer, this._token);
 }
示例#5
0
 private void OnEnable()
 {
     this._token = CullingGrid.Register(this._renderer);
 }