Пример #1
0
    private void updateInfoBoard()
    {
        for (int i = 0; i < items.Count; i++)
        {
            if (items[i].pressed && i != _active)
            {
                _active = i;
                _infoBoard.SetFrame(items[i].ID + 1);

                if (_infoBoard.alpha != 1.0f)
                {
                    _infoBoard.alpha = 1.0f;
                }
            }
        }
    }
Пример #2
0
    private void checkCollisions()
    {
        for (int i = 0; i < blocks.Count; i++)
        {
            if (blocks[i].Holding)
            {
                for (int j = 0; j < blocks.Count; j++)
                {
                    BlockBS thisBlock  = blocks[i];
                    BlockBS otherBlock = blocks[j];

                    if (thisBlock != otherBlock)
                    {
                        if (Mathf.Abs(otherBlock.Position.x - thisBlock.Position.x) <= thisBlock.radiusX + otherBlock.radiusX &&
                            Mathf.Abs(otherBlock.Position.y - thisBlock.Position.y) <= thisBlock.radiusY + otherBlock.radiusY)
                        {
                            handleCollisions(thisBlock, otherBlock);
                        }
                    }
                }

                handleBoundaryCollisions(blocks[i]);
            }

            foreach (Bones bone in bones)
            {
                BlockBS block = blocks[i];

                if (Mathf.Abs(block.Position.x - bone.x) <= block.radiusX + bone.width / 2 &&
                    Mathf.Abs(block.Position.y - bone.y) <= block.radiusY + bone.height / 2)
                {
                    bone._isBoneMoving = true;

                    if (_infoBoard.alpha < 0.5f)
                    {
                        _infoBoard.alpha = 1.0f;
                    }

                    if (bone == bone1)
                    {
                        _infoBoard.SetFrame(0);
                    }
                    else if (bone == bone2)
                    {
                        _infoBoard.SetFrame(1);
                    }
                    else if (bone == bone3)
                    {
                        _infoBoard.SetFrame(2);
                    }
                }
            }
        }
    }