public void UpdateDynamicCellPartition(GameTime gameTime) { if (EntityWithinBounds(CellSpacePartition.GetCenterPartition(Camera.Instance.center))) { AddCellToUpdate(CellSpacePartition.GetCenterPartition(Camera.Instance.center)); //cellSpacePartition.dynamicCells[CellSpacePartition.GetCenterPartition(Camera.Instance.center)].Update(gameTime); } if (EntityWithinBounds(CellSpacePartition.GetTopLeftPartition(Camera.Instance.center))) { AddCellToUpdate(CellSpacePartition.GetTopLeftPartition(Camera.Instance.center)); //cellSpacePartition.dynamicCells[CellSpacePartition.GetTopLeftPartition(Camera.Instance.center)].Update(gameTime); } if (EntityWithinBounds(CellSpacePartition.GetTopPartition(Camera.Instance.center))) { AddCellToUpdate(CellSpacePartition.GetTopPartition(Camera.Instance.center)); //cellSpacePartition.dynamicCells[CellSpacePartition.GetTopPartition(Camera.Instance.center)].Update(gameTime); } if (EntityWithinBounds(CellSpacePartition.GetTopRightPartition(Camera.Instance.center))) { AddCellToUpdate(CellSpacePartition.GetTopRightPartition(Camera.Instance.center)); //cellSpacePartition.dynamicCells[CellSpacePartition.GetTopRightPartition(Camera.Instance.center)].Update(gameTime); } if (EntityWithinBounds(CellSpacePartition.GetRightPartition(Camera.Instance.center))) { AddCellToUpdate(CellSpacePartition.GetRightPartition(Camera.Instance.center)); //cellSpacePartition.dynamicCells[CellSpacePartition.GetRightPartition(Camera.Instance.center)].Update(gameTime); } if (EntityWithinBounds(CellSpacePartition.GetLeftPartition(Camera.Instance.center))) { AddCellToUpdate(CellSpacePartition.GetLeftPartition(Camera.Instance.center)); //cellSpacePartition.dynamicCells[CellSpacePartition.GetLeftPartition(Camera.Instance.center)].Update(gameTime); } if (EntityWithinBounds(CellSpacePartition.GetBottomLeftPartition(Camera.Instance.center))) { AddCellToUpdate(CellSpacePartition.GetBottomLeftPartition(Camera.Instance.center)); //cellSpacePartition.dynamicCells[CellSpacePartition.GetBottomLeftPartition(Camera.Instance.center)].Update(gameTime); } if (EntityWithinBounds(CellSpacePartition.GetBottomPartition(Camera.Instance.center))) { AddCellToUpdate(CellSpacePartition.GetBottomPartition(Camera.Instance.center)); //cellSpacePartition.dynamicCells[CellSpacePartition.GetBottomPartition(Camera.Instance.center)].Update(gameTime); } if (EntityWithinBounds(CellSpacePartition.GetBottomRightPartition(Camera.Instance.center))) { AddCellToUpdate(CellSpacePartition.GetBottomRightPartition(Camera.Instance.center)); //cellSpacePartition.dynamicCells[CellSpacePartition.GetBottomRightPartition(Camera.Instance.center)].Update(gameTime); } for (int i = 0; i < _partitionsToUpdate.Count; i++) { cellSpacePartition.dynamicCells[_partitionsToUpdate[i]].Update(gameTime); } // clear the partitions after every update _partitionsToUpdate.Clear(); }