示例#1
0
    void Update()
    {
        if (ci.MoveLeft(player))
        {
            moveRawImage.texture = moveActiveIcon;
        }
        else if (ci.MoveRight(player))
        {
            moveRawImage.texture = moveActiveIcon;
        }
        else
        {
            moveRawImage.texture = moveIcon;
        }

        if (ci.RotLeft(player))
        {
            rotRawImage.texture = rotActiveIcon;
        }
        else if (ci.RotRight(player))
        {
            rotRawImage.texture = rotActiveIcon;
        }
        else
        {
            rotRawImage.texture = rotIcon;
        }

        if (ci.MoveDownCombined())
        {
            downRawImage.texture = downActiveIcon;
        }
        else if (ci.MoveDown(1))
        {
            downRawImage.texture = downLeftIcon;
        }
        else if (ci.MoveDown(2))
        {
            downRawImage.texture = downRightIcon;
        }
        else
        {
            downRawImage.texture = downIcon;
        }

        //moveRawImage.transform.eulerAngles = new Vector3(0, 0, -40 *  ci.MoveTilt(player));
        //rotRawImage.transform.eulerAngles = new Vector3(0, 0, -45 *  ci.RotTilt(player));
    }
示例#2
0
    protected virtual void Update()
    {
        // Default position not valid? Then it's game over
        if (!isValidGridPos())
        {
            game_over = true;
            Destroy(currentBlock);
            Destroy(this);
        }

        if (Input.GetKeyDown(KeyCode.G))
        {
            ghostActive = !ghostActive;
        }

        if (Input.GetKeyDown(KeyCode.H))
        {
            highColumnActive = !highColumnActive;
        }

        // TODO(Douglas): Clean up button checking for wiimotes.
        // Move Left
        if (ci.MoveLeft(team) && !move)
        {
            move = true;
            StartCoroutine("MoveLeftX");
        }

        // Move Right
        else if (ci.MoveRight(team) && !move)
        {
            move = true;
            StartCoroutine("MoveRightX");
        }

        // Rotate Left
        else if (ci.RotLeft(team) && !rotate)
        {
            rotate = true;
            StartCoroutine("RotateLeftX");
        }

        // Rotate Left
        else if (ci.RotRight(team) && !rotate)
        {
            rotate = true;
            StartCoroutine("RotateRightX");
        }

        if (ci.MoveLeft(other_team) && !move)
        {
            move = true;
            StartCoroutine("MoveLeftZ");
        }

        else if (ci.MoveRight(other_team) && !move)
        {
            move = true;
            StartCoroutine("MoveRightZ");
        }

        else if (ci.RotLeft(other_team) && !rotate)
        {
            rotate = true;
            StartCoroutine("RotateLeftZ");
        }

        else if (ci.RotRight(other_team) && !rotate)
        {
            rotate = true;
            StartCoroutine("RotateRightZ");
        }

        if ((ci.MoveDownCombined() ||
             Time.time - lastFall >= fallRate * fallRateMultiplier) && !fall)
        {
            fall = true;
            StartCoroutine("Fall");
        }

        applyTransparency();
        speedUp();
    }