コード例 #1
0
    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);
    }
コード例 #2
0
    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);
        }
    }
コード例 #3
0
    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();
    }