예제 #1
0
    // Update is called once per frame
    void Update()
    {
        switch (fallState)
        {
            #region 自然落下
        case FallState.FREEFALL:
            //自然落下時間を計測
            freefallTime += UnityEngine.Time.deltaTime;

            //自然落下時間になったら
            if (freefallTime >= FREEFALL_TIME[gameController.stage])
            {
                //自然落下時間をリセット
                freefallTime = 0f;

                //下移動
                gameObject.transform.position -= COL;
                //移動先の中身が空ではなかったら
                if (!blockController.BlockFieldCheck())
                {
                    //上移動で戻す
                    gameObject.transform.position += COL;
                }
            }

            if (Input.GetKey(KeyCode.DownArrow))
            {
                //状態を高速落下に
                fallState = FallState.FAST_FALL;
            }
            break;
            #endregion

            #region 高速落下
        case FallState.FAST_FALL:
            //高速落下
            FastFall();

            break;
            #endregion

            #region 着地
        case FallState.LANDING:
            //配列に格納
            blockController.ArrayStore();

            //状態を停止に
            fallState = FallState.STOP;
            gameController.Create();
            break;
            #endregion

        case FallState.STOP:

            break;
        }

        //着地
        UpdateLanding();

        //状態がゲーム中では無かったら
        if (gameController.gameState != GameController.GameState.PLAY)
        {
            //状態を停止に
            fallState = FallState.STOP;
        }

#if UNITY_EDITOR || UNITY_IOS || UNITY_ANDROID
        //状態が落下中だったら
        if (fallState == FallState.FREEFALL || fallState == FallState.FAST_FALL)
        {
            if (touchController.fastFall)
            {
                //高速落下
                FastFall();

                touchController.nextFlick = false;
            }
        }
#endif
    }