コード例 #1
0
ファイル: Tetromino.cs プロジェクト: Hwang2442/Unity-Tetris
    private void Update()
    {
        // Move Left
        if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            MoveDirection(Vector3.left);
        }
        // Move Right
        else if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            MoveDirection(Vector3.right);
        }
        // Rotate
        else if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            RotateDirection(Vector3.forward);
        }
        // Full Down
        else if (Input.GetKeyDown(KeyCode.Space))
        {
            FullDown();
        }
        // Hold
        else if (Input.GetKeyDown(KeyCode.C))
        {
            StopCoroutine(fallingCoroutine);    // 코루틴 종료

            BlockReturn();                      // 블럭 반납

            gameObject.SetActive(false);

            spawner.HoldBlock();
        }
    }