Exemple #1
0
    IEnumerator fallingGap()
    {
        yield return(new WaitForSeconds(fallingSpeed));

        //If reach the bottom, create new puyo
        if (PuyoController.reachBottom((int)controlMainPuyo.getPosition().x, (int)controlMainPuyo.getPosition().y) ||
            PuyoController.reachBottom((int)controlSubPuyo.getPosition().x, (int)controlSubPuyo.getPosition().y))
        {
            if (PuyoController.isGameOver())
            {
                gameOverObj.SetActive(true);
                gameStatus = GameStatus.GamePause;
            }
            else
            {
                int mainX = (int)controlMainPuyo.getPosition().x;
                int mainY = (int)controlMainPuyo.getPosition().y;
                int subX  = (int)controlSubPuyo.getPosition().x;
                int subY  = (int)controlSubPuyo.getPosition().y;
                puyoArr[mainX, mainY] = controlMainPuyo;
                puyoArr[subX, subY]   = controlSubPuyo;

                gameStatus = GameStatus.PuyoArranging;
            }
        }
        else
        {
            PuyoController.puyoDown(true);
        }
        falling = true;
    }
Exemple #2
0
    void Update()
    {
        if (player.gameStatus == GameMaster.GameStatus.PuyoFalling)
        {
            if (Input.GetKeyDown(KeyCode.LeftArrow) && (!controller.havingObstacle(0, (int)player.controlMainPuyo.getPosition().x, (int)player.controlMainPuyo.getPosition().y) &&
                                                        !controller.havingObstacle(0, (int)player.controlSubPuyo.getPosition().x, (int)player.controlSubPuyo.getPosition().y)))
            {
                FindObjectOfType <AudioManager>().Play("move");
                controller.puyoLeft(true);
            }
            if (Input.GetKeyDown(KeyCode.RightArrow) && (!controller.havingObstacle(1, (int)player.controlMainPuyo.getPosition().x, (int)player.controlMainPuyo.getPosition().y) &&
                                                         !controller.havingObstacle(1, (int)player.controlSubPuyo.getPosition().x, (int)player.controlSubPuyo.getPosition().y)))
            {
                FindObjectOfType <AudioManager>().Play("move");
                controller.puyoRight(true);
            }
            if (Input.GetKeyDown(KeyCode.DownArrow) && (!controller.reachBottom((int)player.controlMainPuyo.getPosition().x, (int)player.controlMainPuyo.getPosition().y) &&
                                                        !controller.reachBottom((int)player.controlSubPuyo.getPosition().x, (int)player.controlSubPuyo.getPosition().y)))
            {
                FindObjectOfType <AudioManager>().Play("move");
                controller.puyoDown(true);
            }
            //counterclockwise
            if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.UpArrow))
            {
                controller.puyoCounterclockwise();
                FindObjectOfType <AudioManager>().Play("rotate");
            }
            //clockwise
            if (Input.GetKeyDown(KeyCode.RightShift))
            {
                controller.puyoClockwise();
                FindObjectOfType <AudioManager>().Play("rotate");
            }
            if (Input.GetKeyUp(KeyCode.Space))
            {
                //test key

                /*FindObjectOfType<AudioManager>().Play("gameOver");
                 * player.gameOverObj.SetActive(true);
                 * player.gameStatus = GameMaster.GameStatus.GamePause;
                 * FindObjectOfType<AudioManager>().StopPlaying("music");*/
                SceneManager.LoadScene("Main");
            }
        }
    }
    IEnumerator fallingGap()
    {
        yield return(new WaitForSeconds(fallingSpeed));

        //If reach the bottom, create new puyo
        if (controller.reachBottom((int)controlMainPuyo.getPosition().x, (int)controlMainPuyo.getPosition().y) ||
            controller.reachBottom((int)controlSubPuyo.getPosition().x, (int)controlSubPuyo.getPosition().y))
        {
            int mainX = (int)controlMainPuyo.getPosition().x;
            int mainY = (int)controlMainPuyo.getPosition().y;
            int subX  = (int)controlSubPuyo.getPosition().x;
            int subY  = (int)controlSubPuyo.getPosition().y;
            puyoArr[mainX, mainY] = controlMainPuyo;
            puyoArr[subX, subY]   = controlSubPuyo;

            gameStatus = GameStatus.PuyoArranging;
            controller.checkTowerTooHigh();
        }
        else
        {
            controller.puyoDown(true);
        }
        falling = true;
    }
Exemple #4
0
 void Update()
 {
     if (player.gameStatus == GameMaster.GameStatus.PuyoFalling)
     {
         if (Input.GetKeyDown(KeyCode.A) && (!controller.havingObstacle(0, (int)player.controlMainPuyo.getPosition().x, (int)player.controlMainPuyo.getPosition().y) &&
                                             !controller.havingObstacle(0, (int)player.controlSubPuyo.getPosition().x, (int)player.controlSubPuyo.getPosition().y)))
         {
             FindObjectOfType <AudioManager>().Play("move");
             controller.puyoLeft(true);
         }
         if (Input.GetKeyDown(KeyCode.D) && (!controller.havingObstacle(1, (int)player.controlMainPuyo.getPosition().x, (int)player.controlMainPuyo.getPosition().y) &&
                                             !controller.havingObstacle(1, (int)player.controlSubPuyo.getPosition().x, (int)player.controlSubPuyo.getPosition().y)))
         {
             FindObjectOfType <AudioManager>().Play("move");
             controller.puyoRight(true);
         }
         if (Input.GetKeyDown(KeyCode.S) && (!controller.reachBottom((int)player.controlMainPuyo.getPosition().x, (int)player.controlMainPuyo.getPosition().y) &&
                                             !controller.reachBottom((int)player.controlSubPuyo.getPosition().x, (int)player.controlSubPuyo.getPosition().y)))
         {
             FindObjectOfType <AudioManager>().Play("move");
             controller.puyoDown(true);
         }
         //counterclockwise
         if (Input.GetKeyDown(KeyCode.X) || Input.GetKeyDown(KeyCode.W))
         {
             controller.puyoCounterclockwise();
             FindObjectOfType <AudioManager>().Play("rotate");
         }
         //clockwise
         if (Input.GetKeyDown(KeyCode.Z))
         {
             controller.puyoClockwise();
             FindObjectOfType <AudioManager>().Play("rotate");
         }
     }
 }
    // Update is called once per frame
    void Update()
    {
        if (GameMaster.gameStatus == GameMaster.GameStatus.PuyoFalling)
        {
            if (Input.GetKeyUp(KeyCode.LeftArrow) && (!PuyoController.havingObstacle(0, (int)GameMaster.controlMainPuyo.getPosition().x, (int)GameMaster.controlMainPuyo.getPosition().y) &&
                                                      !PuyoController.havingObstacle(0, (int)GameMaster.controlSubPuyo.getPosition().x, (int)GameMaster.controlSubPuyo.getPosition().y)))
            {
                PuyoController.puyoLeft(true);
            }
            if (Input.GetKeyUp(KeyCode.RightArrow) && (!PuyoController.havingObstacle(1, (int)GameMaster.controlMainPuyo.getPosition().x, (int)GameMaster.controlMainPuyo.getPosition().y) &&
                                                       !PuyoController.havingObstacle(1, (int)GameMaster.controlSubPuyo.getPosition().x, (int)GameMaster.controlSubPuyo.getPosition().y)))
            {
                PuyoController.puyoRight(true);
            }
            if (Input.GetKeyUp(KeyCode.DownArrow) && (!PuyoController.reachBottom((int)GameMaster.controlMainPuyo.getPosition().x, (int)GameMaster.controlMainPuyo.getPosition().y) &&
                                                      !PuyoController.reachBottom((int)GameMaster.controlSubPuyo.getPosition().x, (int)GameMaster.controlSubPuyo.getPosition().y)))
            {
                PuyoController.puyoDown(true);
            }
            //counterclockwise
            if (Input.GetKeyUp(KeyCode.Z))
            {
                PuyoController.puyoCounterclockwise();
            }
            //clockwise
            if (Input.GetKeyUp(KeyCode.X))
            {
                PuyoController.puyoClockwise();
            }
            //Hold

            /*if (Input.GetKeyUp(KeyCode.Space))
             * {
             *  PuyoController.hold();
             * }*/
        }
    }