Пример #1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.T))
     {
         //Shake(mTime);
         ShakeCamera.ShakeAll(mTime);
     }
 }
Пример #2
0
    IEnumerator Shake(float aShakeTime, float aShakeMagnitude, float aShakeDelay)
    {
        //待機
        yield return(new WaitForSeconds(aShakeDelay));

        ShakeCamera.ShakeAll(aShakeTime, aShakeMagnitude);         //カメラを揺らす

        //プレイヤーを移動可能にするまで待機
        yield return(new WaitForSeconds(aShakeTime));

        SetPlayerCanMove(true);
    }
 void OnLand(WeightManager.Weight aWeight, LandImpact.CEnviroment aEnviroment)
 {
     //重さが2で
     if (aWeight == WeightManager.Weight.heavy)
     {
         //水中か、地上に着地したら
         if (aEnviroment == LandImpact.CEnviroment.cWater || aEnviroment == LandImpact.CEnviroment.cGround)
         {
             ShakeCamera.ShakeAll(mShakeTime);                       //カメラを揺らす
         }
     }
 }
Пример #4
0
    //エリアの開放イベント
    //
    IEnumerator AreaOpenEvent(int aAreaNumber)
    {
        //エラーチェック
        if (aAreaNumber == 2)
        {
        }
        else if (aAreaNumber == 3)
        {
        }
        else if (aAreaNumber == 4)
        {
        }
        else
        {
            Debug.LogError("エリア2、エリア3、エリア4以外でエリア開放イベントが呼ばれました", this);
        }



        //元のデータを保存
        Vector3 lBeforeCameraPosition          = mCameraMove.transform.position;
        Vector3 lBeforeCameraMoveStartPosition = mCameraMove.mStartPosition;
        Vector3 lBeforeCameraMoveEndPosition   = mCameraMove.mEndPosition;
        float   lBeforeCameraMoveTakeTime      = mCameraMove.mTakeTime;


        //
        //カメラを現在地点から、演出する位置まで動かす
        //

        Vector3 lEventCameraPosition = Vector3.zero;

        //エリア2の開放演出なら
        if (aAreaNumber == 2)
        {
            lEventCameraPosition   = mTopStaticWeightBox.transform.position;
            lEventCameraPosition.z = 35.0f;
        }
        //エリア3の開放演出なら
        else if (aAreaNumber == 3)
        {
            lEventCameraPosition   = mBottomStaticWeightBox.transform.position;
            lEventCameraPosition.z = 35.0f;
        }
        //エリア4の開放演出なら
        else if (aAreaNumber == 4)
        {
            lEventCameraPosition    = mArea1ToExDoor.transform.position;
            lEventCameraPosition.z  = 35.0f;
            lEventCameraPosition.y += 1.0f;
        }

        //移動の情報の設定
        mCameraMove.mTakeTime      = 2.0f;
        mCameraMove.mStartPosition = mCameraMove.transform.position;
        mCameraMove.mEndPosition   = lEventCameraPosition;
        mCameraMove.MoveStart();

        //動き終わるまで待機
        while (true)
        {
            if (mCameraMove.IsMoveEnd == true)
            {
                break;
            }
            yield return(null);
        }


        //
        //開放演出
        //

        if (aAreaNumber == 2)
        {
            //
            //ボックスが壁からにゅるっと出てくる
            //

            mTopStaticWeightBox.SetActive(true);

            Vector3 lStart = mTopStaticWeightBox.transform.position;
            lStart.x += 3.0f;
            Vector3 lEnd = mTopStaticWeightBox.transform.position;

            float       lTime     = 0.0f;
            const float cTakeTime = 3.0f;
            while (true)
            {
                lTime += Time.deltaTime;

                mTopStaticWeightBox.transform.position = Vector3.Lerp(lStart, lEnd, Mathf.Clamp01(lTime / cTakeTime));

                if (lTime >= cTakeTime)
                {
                    break;
                }
                yield return(null);
            }

            yield return(new WaitForSeconds(1.0f));
        }
        else if (aAreaNumber == 3)
        {
            //
            //ボックスが壁からにゅるっと出てくる
            //

            mBottomStaticWeightBox.SetActive(true);

            Vector3 lStart = mBottomStaticWeightBox.transform.position;
            lStart.x += 3.0f;
            Vector3 lEnd = mBottomStaticWeightBox.transform.position;

            float       lTime     = 0.0f;
            const float cTakeTime = 3.0f;
            while (true)
            {
                lTime += Time.deltaTime;

                mBottomStaticWeightBox.transform.position = Vector3.Lerp(lStart, lEnd, Mathf.Clamp01(lTime / cTakeTime));

                if (lTime >= cTakeTime)
                {
                    break;
                }
                yield return(null);
            }

            yield return(new WaitForSeconds(1.0f));
        }
        else if (aAreaNumber == 4)
        {
            //
            //ドアが壁からにゅるっと出てくる
            //

            /*にゅるっと出すと、背景に透過部分があるのでおかしな見た目になってしまう
             *
             * mArea1ToExDoor.gameObject.SetActive(true);
             *
             * Vector3 lStart = mArea1ToExDoor.transform.position;
             * lStart.z += 2.0f;
             * Vector3 lEnd = mArea1ToExDoor.transform.position;
             *
             * float lTime = 0.0f;
             * const float cTakeTime = 3.0f;
             * while (true) {
             *      lTime += Time.deltaTime;
             *
             *      mArea1ToExDoor.transform.position = Vector3.Lerp(lStart, lEnd, Mathf.Clamp01(lTime / cTakeTime));
             *
             *      if (lTime >= cTakeTime) {
             *              break;
             *      }
             *      yield return null;
             * }
             *
             *
             * //背景を奥にする
             * //
             *
             * lStart = mArea1ToExDoorBackGround.transform.position;
             * lEnd = mArea1ToExDoorBackGround.transform.position;
             * lEnd.z += 2.0f;
             *
             * lTime = 0.0f;
             * const float cTakeTimeBackGround = 1.0f;
             * while (true) {
             *      lTime += Time.deltaTime;
             *
             *      mArea1ToExDoorBackGround.transform.position = Vector3.Lerp(lStart, lEnd, Mathf.Clamp01(lTime / cTakeTimeBackGround));
             *
             *      if (lTime >= cTakeTimeBackGround) {
             *              break;
             *      }
             *      yield return null;
             * }
             *
             */

            //
            //ドアと背景を入れ替える
            //

            yield return(new WaitForSeconds(1.0f));

            //揺れる音再生
            mEarthQuakeSE = SoundManager.SPlay(mEarthQuakeSEPrefab);

            //揺らす
            ShakeCamera.ShakeAll(1.5f, 0.05f);

            yield return(new WaitForSeconds(1.0f));

            //ドアを出す
            mArea1ToExDoor.gameObject.SetActive(true);
            mArea1ToExDoorBackGround.gameObject.SetActive(false);

            yield return(new WaitForSeconds(0.5f));

            //揺れる音停止
            SoundManager.SStop(mEarthQuakeSE);
            Destroy(mEarthQuakeSE);

            yield return(new WaitForSeconds(1.0f));
        }


        //
        //カメラを現在地点から、元の位置まで動かす
        //

        //移動の情報の設定
        mCameraMove.mTakeTime      = 2.0f;
        mCameraMove.mStartPosition = mCameraMove.transform.position;
        mCameraMove.mEndPosition   = lBeforeCameraPosition;
        mCameraMove.MoveStart();

        //動き終わるまで待機
        while (true)
        {
            if (mCameraMove.IsMoveEnd == true)
            {
                break;
            }
            yield return(null);
        }


        //元のデータに戻す
        mCameraMove.mStartPosition = lBeforeCameraMoveStartPosition;
        mCameraMove.mEndPosition   = lBeforeCameraMoveEndPosition;
        mCameraMove.mTakeTime      = lBeforeCameraMoveTakeTime;
    }
Пример #5
0
    IEnumerator EndingCoroutine()
    {
        // プレイヤーから自機操作権限を奪う
        for (int idx = 0; idx < (int)VirtualController.CtrlCode.Max; idx++)
        {
            VirtualController.SetAxis((VirtualController.CtrlCode)idx, 0.0f, float.MaxValue);
        }

        // 重さ移しコンポーネントを取得
        MassShift shift = GameObject.FindObjectOfType <MassShift>();

        // プレイヤーから重さ移し権限を奪う
        shift.mOverrideInputFromScript = true;

        // ムービー帯を表示
        Camera.main.GetComponent <MovieBelt>().IsDisplay = true;

        // カーソル位置をプレイヤー位置に移動
        shift.SetCursorPosition(plTrans.position);

        // 待機
        yield return(new WaitForSeconds(1.6f));

        // BGM再生
        SoundManager.SPlay(musicSoundPrefab);

        // 待機
        yield return(new WaitForSeconds(2.4f));

        // カーソル位置のオブジェクトを生成
        GameObject cursorPoint = new GameObject("CursorPoint");

        cursorPoint.transform.parent = transform;

        // カーソルを移す元に移動
        HermiteCurveMove hermite = cursorPoint.AddComponent <HermiteCurveMove>();

        hermite.SetPoints(plTrans.position, shiftFromTrans.position, ((plTrans.position + shiftFromTrans.position) * 0.5f));
        while (hermite.Ratio <= 1.0f)
        {
            shift.SetCursorPosition(hermite.Point);
            yield return(null);
        }
        shift.SetCursorPosition(shiftFromTrans.position);
        Destroy(hermite);

        // 待機
        yield return(new WaitForSeconds(0.5f));

        // 重さ移し入力を有効化
        shift.mInputClick = true;

        // 待機
        yield return(new WaitForSeconds(0.5f));

        // カーソルを移す先に移動
        hermite = cursorPoint.AddComponent <HermiteCurveMove>();
        hermite.SetPoints(shiftFromTrans.position, shiftToTrans.position, ((shiftFromTrans.position + shiftToTrans.position) * 0.5f));
        while (hermite.Ratio <= 1.0f)
        {
            shift.SetCursorPosition(hermite.Point);
            yield return(null);
        }
        shift.SetCursorPosition(shiftToTrans.position);
        Destroy(hermite);

        // 待機
        yield return(new WaitForSeconds(0.5f));

        // 重さ移し入力を無効化
        shift.mInputClick = false;

        // カーソルを非表示
        shift.mInvisibleCursor = true;

        // カーソルを移動する時間を設定
        float cursorMoveTime = (Time.time + shift.ShiftTimes);

        // 重さ移し演出を強化
        List <GameObject> particleList = new List <GameObject>();
        Vector3           center       = ((shiftFromTrans.position + shiftToTrans.position) * 0.5f);
        Vector3           pointA       = new Vector3(((shiftFromTrans.position.x - center.x) * particleRandomVec + center.x), ((shiftToTrans.position.y - center.y) * particleRandomVec + center.y), center.z);
        Vector3           pointB       = new Vector3(((shiftToTrans.position.x - center.x) * particleRandomVec + center.x), ((shiftFromTrans.position.y - center.y) * particleRandomVec + center.y), center.z);
        float             lastWaitTime = Time.time;
        int endCnt = 1;

        SetSizeUpParticle((float)endCnt / (float)particleNum);
        for (int cnt = 1; cnt < particleNum; cnt++)
        {
            GameObject newParticle = Instantiate(shiftParticle);
            hermite = newParticle.AddComponent <HermiteCurveMove>();

            Vector3 vec      = new Vector3((Random.value * 2.0f - 1.0f), (Random.value * 2.0f - 1.0f), 0.0f).normalized;
            Vector3 midPoint = (shiftFromTrans.position) + vec * shiftHopForce;

            hermite.SetPoints(shiftFromTrans.position, shiftToTrans.position, midPoint);
            hermite.EndDestroy = true;
            particleList.Add(newParticle);

            SoundManager.SPlay(shiftSoundPrefab);

            while (Time.time < (lastWaitTime + particleStandbyTime))
            {
                // カーソル移動判定
                if (cursorMoveTime < Time.time)
                {
                    shift.SetCursorPosition(Vector3.right * 100.0f);
                }

                // 終了したパーティクルをカウント
                while ((particleList.Count > 0) && !particleList[0])
                {
                    particleList.RemoveAt(0);
                    endCnt++;
                    SetSizeUpParticle((float)endCnt / (float)particleNum);
                }
                yield return(null);
            }
            lastWaitTime = Time.time;
            //yield return new WaitForSeconds(particleStandbyTime);
        }

        // 待機
        lastWaitTime = Time.time;
        while (endCnt < (particleNum - 1))
        {
            // 終了したパーティクルをカウント
            while ((particleList.Count > 0) && !particleList[0])
            {
                SoundManager.SPlay(shiftSoundPrefab);
                particleList.RemoveAt(0);
                endCnt++;
                SetSizeUpParticle((float)endCnt / (float)particleNum);
                lastWaitTime = Time.time;
            }
            yield return(null);
        }
        SetSizeUpParticle(1.0f);

        // 待機
        yield return(new WaitForSeconds(0.08f));

        // 落下開始
        boxLockCol.transform.position += (Vector3.down * armCrashDownDis);

        // 待機
        yield return(new WaitForSeconds(0.15f));

        // アームを開く
        armAnim.Play("arm");
        boxLockCol.enabled = false;
        SoundManager.SPlay(impactSoundPrefab);

        // アーム移動
        SoundManager.SPlay(impactSoundPrefab);
        float armMoveBeginTime = Time.time;

        while (true)
        {
            if ((armMoveBeginTime + armMoveTime) <= Time.time)
            {
                break;
            }
            float ratio = ((Time.time - armMoveBeginTime) / armMoveTime);
            armTrans.position = new Vector3(Mathf.Lerp(armBefPoint.position.x, armAftPoint.position.x, ratio), Mathf.Lerp(armBefPoint.position.y, armAftPoint.position.y, ratio), Mathf.Lerp(armBefPoint.position.z, armAftPoint.position.z, ratio));
            armTrans.rotation = Quaternion.Slerp(armBefPoint.rotation, armAftPoint.rotation, ratio);
            yield return(null);
        }

        // 待機
        yield return(new WaitForSeconds(0.5f));

        // 着地演出
        ShakeCamera.ShakeAll(shakeTime, shakeMagnitude);
        GameObject impactEffectObj = Instantiate(impactEffect);

        impactEffectObj.transform.position = impactEffectTrans.position;
        SoundManager.SPlay(impactSoundPrefab);

        // 背景セルの色を全て変更
        foreach (var cell in backgroundCellList)
        {
            cell.PowerfulLighting(backgourndCellMidMat);
        }

        // 背景セルの色を変更する巨大化する球を生成
        GameObject cellChangeSphereObj = Instantiate(cellChangeSpherePrefab, cellChangeSpherePoint);

        cellChangeSphereObj.transform.localPosition = Vector3.zero;

        // 待機
        yield return(new WaitForSeconds(1.0f));

        // カメラを扉にズーム
        float   zoomBeginTime = Time.time;
        Vector3 defCamPos     = Camera.main.transform.position;

        while (true)
        {
            float ratio = ((Time.time - zoomBeginTime) / camZoomTime);

            if (ratio >= 1.0f)
            {
                Camera.main.transform.position = camZoomPoint.position;
                break;
            }

            Camera.main.transform.position = new Vector3(Mathf.Lerp(defCamPos.x, camZoomPoint.position.x, ratio), Mathf.Lerp(defCamPos.y, camZoomPoint.position.y, ratio), Mathf.Lerp(defCamPos.z, camZoomPoint.position.z, ratio));
            yield return(null);
        }

        // 扉を開く
        doorAnim.Play("Open");
        SoundManager.SPlay(doorOpenSoundPrefab);

        // 待機
        yield return(new WaitForSeconds(3.0f));

        // 自機を扉の前に移動
        while (plTrans.position.x < doorFrontTrans.position.x)
        {
            VirtualController.SetAxis(VirtualController.CtrlCode.Horizontal, 0.1f);
            yield return(null);
        }

        // 自機の位置を補正
        plTrans.GetComponent <MoveManager>().StopMoveHorizontalAll();
        VirtualController.SetAxis(VirtualController.CtrlCode.Horizontal, 0.0f, float.MaxValue);
        plTrans.position = new Vector3(doorFrontTrans.position.x, plTrans.position.y, plTrans.position.z);

        // 自機を扉に向ける
        Player pl = plTrans.GetComponent <Player>();

        pl.CamLookDown     = true;
        pl.CameraLookRatio = 0.0f;
        pl.LookCamera();
        pl.enabled = false;
        Quaternion defPlRot    = pl.transform.rotation;
        Quaternion doorLookRot = Quaternion.LookRotation(doorInPointTrans.position - pl.transform.position) * Quaternion.Euler(0.0f, -90.0f, 0.0f);

        float doorLookBeginTime = Time.time;

        while (true)
        {
            float ratio = ((Time.time - doorLookBeginTime) / doorLookTime);
            if (ratio >= 1.0f)
            {
                plTrans.rotation = doorLookRot;
                break;
            }
            plTrans.rotation = Quaternion.Slerp(defPlRot, doorLookRot, ratio);
            yield return(null);
        }

        // 待機
        PlayerAnimation plAnim = pl.GetComponent <PlayerAnimation>();

        plAnim.StartStandBy();
        yield return(new WaitForSeconds(1.0f));

        plAnim.StartWalk();

        // 自機を扉の中に移動
        Camera.main.transform.parent = plTrans;
        Vector3 defPlPos        = plTrans.position;
        float   doorInBeginTime = Time.time;

        while (true)
        {
            float ratio = ((Time.time - doorInBeginTime) / doorInTime);
            if (ratio >= 1.0f)
            {
                plTrans.position = doorInPointTrans.position;
                break;
            }
            plTrans.position = new Vector3(Mathf.Lerp(defPlPos.x, doorInPointTrans.position.x, ratio), Mathf.Lerp(defPlPos.y, doorInPointTrans.position.y, ratio), Mathf.Lerp(defPlPos.z, doorInPointTrans.position.z, ratio));
            yield return(null);
        }

        // 待機
        yield return(new WaitForSeconds(0.75f));

        // 立ち止まる
        plAnim.StartStandBy();

        // ムービー帯解除
        Camera.main.GetComponent <MovieBelt>().IsDisplay = false;
        while (Camera.main.GetComponent <MovieBelt>().Ratio <= 0.0f)
        {
            yield return(null);
        }
        ;

        // 待機
        yield return(new WaitForSeconds(0.5f));

        float creditBeginTime = Time.time;

        while (true)
        {
            float ratio = ((Time.time - creditBeginTime) / creditTime);
            if (ratio >= 1.0f)
            {
                creditTrans.position = creditEndPoint.position;
                break;
            }
            creditTrans.position = new Vector3(Mathf.Lerp(creditBeginPoint.position.x, creditEndPoint.position.x, ratio), Mathf.Lerp(creditBeginPoint.position.y, creditEndPoint.position.y, ratio), Mathf.Lerp(creditBeginPoint.position.z, creditEndPoint.position.z, ratio));
            yield return(null);
        }

        // 待機
        yield return(new WaitForSeconds(4.3f));

        // シーン遷移
        ((ChangeScene)FindObjectOfType(typeof(ChangeScene))).OnTitleButtonDown();               // タイトルへ
    }