Beispiel #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;
    }
Beispiel #2
0
 // Update is called once per frame
 void Start()
 {
     if (player_object != null)
     {
         controller = player_object.GetComponent <PuyoController>();
         player     = player_object.GetComponent <GameMaster>();
     }
 }
Beispiel #3
0
    //Before eliminated puyo, wait a while.
    IEnumerator statusChangingGap()
    {
        yield return(new WaitForSeconds(0.8f));

        StartCoroutine("showComboImg");
        ImageController.setComboNumber(++comboNumber);
        PuyoController.eliminatePuyo();
        gameStatus = GameStatus.PuyoArranging;
    }
Beispiel #4
0
 // Use this for initialization
 void Start()
 {
     creater          = this.GetComponent <PuyoCreater>();
     controller       = this.GetComponent <PuyoController>();
     puyoArr          = new Puyo[6, 13];
     puyoGroupObj     = puyoGroup;
     gameOverObj      = gameOver;
     puyoInventory    = new Queue <Puyo>();
     gameStatus       = GameStatus.GameInitializing;
     mainPuyoShinyObj = mainPuyoShiny;
 }
Beispiel #5
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (gameStatus == GameStatus.GameInitializing)
        {
            puyoInventory.Enqueue(PuyoCreater.PuyoCreate(100, 175));
            puyoInventory.Enqueue(PuyoCreater.PuyoCreate(100, 143));
            puyoInventory.Enqueue(PuyoCreater.PuyoCreate(100, 50));
            puyoInventory.Enqueue(PuyoCreater.PuyoCreate(100, 18));

            gameStatus = GameStatus.PuyoCreating;
        }

        if (gameStatus == GameStatus.PuyoCreating)
        {
            PuyoController.puyoCreate();
            gameStatus = GameStatus.PuyoFalling;
        }

        if (gameStatus == GameStatus.PuyoFalling)
        {
            if (falling)
            {
                StartCoroutine("fallingGap");
                falling = false;
            }
        }

        if (gameStatus == GameStatus.PuyoArranging)
        {
            PuyoController.puyoArrange();
            gameStatus = GameStatus.PuyoLinking;
        }

        if (gameStatus == GameStatus.PuyoLinking)
        {
            PuyoController.resetPuyoStatusAndLinkPuyoList();
            PuyoController.linkSamePuyo();
            gameStatus = GameStatus.ComboCalculating;
        }

        if (gameStatus == GameStatus.ComboCalculating)
        {
            if (PuyoController.readyToEliminatePuyo())
            {
                StartCoroutine("statusChangingGap");
                gameStatus = GameStatus.GamePause;
            }
            else
            {
                gameStatus = GameStatus.PuyoCreating;
            }
        }
    }
    // 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();
             * }*/
        }
    }