public void nextBlock() { Bounds topBlockBounds = _topBlock.Bounds; Bounds movingBounds = ProcessOverlap.CalculateAboveBounds(ref topBlockBounds); Vector3 start = spawnOffset() + movingBounds.center; Vector3 end = movingBounds.center - spawnOffset(); _movingBlock = factory.generatePingPongBlock(ref movingBounds, start, end); }
void GenerateInitialStack() { Bounds blockBounds = new Bounds(Vector3.zero, new Vector3(0.42f, 0.42f)); for (int i = 0; i < 5; ++i) { _topBlock = factory.generateStaticBlock(ref blockBounds); blockBounds = ProcessOverlap.CalculateAboveBounds(ref blockBounds); } }
public void PlaceBlock() { Bounds movingBlockBounds = _movingBlock.Bounds; Bounds topBlockBounds = _topBlock.Bounds; //========================================== //========================================== _movingBlock.DOKill(); Destroy(_movingBlock.gameObject); // Check to see if the block overlaps with the top of the stack if (ProcessOverlap.Overlap(ref movingBlockBounds, ref topBlockBounds)) { // gen staticBlock and gen rigid Block _topBlock = factory.generateStaticBlock(ref movingBlockBounds); } nextBlock(); }