Beispiel #1
0
    void PerformPlayerControlledMovement()
    {
        if (currentBlock == null)
        {
            return;
        }

        if (Input.GetButtonDown("rotateclockwise"))
        {
            currentBlock.RotateClockwise(tetrisBoard);
            soundEngine.PlaySoundWithName("BlockRotate");
        }
        if (Input.GetButtonDown("rotatecounterclockwise"))
        {
            currentBlock.RotateCounterClockwise(tetrisBoard);
            soundEngine.PlaySoundWithName("BlockRotate");
        }

        if (Input.GetButtonDown("left"))
        {
            currentBlock.MoveLeft(tetrisBoard);
            soundEngine.PlaySoundWithName("BlockMove");
        }

        if (Input.GetButtonDown("right"))
        {
            currentBlock.MoveRight(tetrisBoard);
            soundEngine.PlaySoundWithName("BlockMove");
        }

        if (Input.GetButtonDown("up"))
        {
            currentBlock.MoveDownMax(tetrisBoard);
        }
        else if (Input.GetButtonDown("down"))
        {
            PerformNextDownwardMove();
            soundEngine.PlaySoundWithName("BlockMove");
        }

        if (Input.GetButtonDown("stash"))
        {
            StashCurrentBlock();
        }

        display.UpdateBoard(tetrisBoard, currentBlock);
    }