Ejemplo n.º 1
0
    //ボタンを動かす
    void MoveLedge()
    {
        Vector3 lNewPosition = mLedgeStartPosition + (mLedgeMoveEnd.transform.position - mLedgeMoveStart.transform.position) * mPushRate;

        MoveManager.MoveTo(lNewPosition, mLedge, LayerMask.GetMask(new string[] { "Box", "Player" }), true);
    }
Ejemplo n.º 2
0
    void UpdateLifting()
    {
        switch (St)
        {
        case LiftState.liftUp:
            // 移動不可
            MoveMng.StopMoveVirticalAll();
            MoveMng.StopMoveHorizontalAll();

            // 持つオブジェクトの補間位置が現在のオブジェクトより高ければ
            bool liftMoveFlg = false;
            if (MoveMng.GravityForce < 0.0f)                    // 接地方向が下
            {
                if (PlAnim.GetBoxPosition().y > liftObj.transform.position.y)
                {
                    liftMoveFlg = true;
                }
            }
            else                                                                        // 接地方向が上
            {
                if (PlAnim.GetBoxPosition().y < liftObj.transform.position.y)
                {
                    liftMoveFlg = true;
                }
            }

            // オブジェクトの位置を同期
            if (liftMoveFlg)
            {
                if (heavyFailedFlg || (!MoveManager.MoveTo(GetLiftUpBoxPoint(), liftObj.GetComponent <BoxCollider>(), liftingColMask)))
                {
                    Debug.Log("持ち上げ失敗");

                    // 同期できなければ下ろす
                    St = LiftState.liftUpFailed;

                    // 失敗アニメーションへの遷移
                    PlAnim.FailedCatch();

                    return;
                }
            }

            // 持ち上げ完了時
            if (PlAnim.CompleteCatch())
            {
                LiftEndObject(liftObj, true);
                //				// 持ち上げ中オブジェクトの判定と挙動を無効化
                //				liftObj.GetComponent<BoxCollider>().enabled = false;
                //				liftObj.GetComponent<MoveManager>().enabled = false;
                //
                //				// 持ち上げ中のプレイヤー当たり判定を有効化
                //				standbyCol.enabled = false;
                //				liftingCol.enabled = true;

                plAnim.ExitCatch();

                // 持ち上げ中状態
                St = LiftState.lifting;
            }
            break;

        case LiftState.liftDown:
            // 移動不可
            MoveMng.StopMoveVirticalAll();
            MoveMng.StopMoveHorizontalAll();

            // オブジェクトの位置を同期
            if (!MoveManager.MoveTo(PlAnim.GetBoxPosition(), liftObj.GetComponent <BoxCollider>(), liftingColMask))
            {
                Debug.Log("下ろし失敗");

                // 同期できなければ離す
                LiftEndObject(liftObj, false);

                // 待機状態に
                St = LiftState.standby;

                // アニメーション遷移
                PlAnim.ExitRelease();

                return;
            }

            // 下ろし完了時
            if (PlAnim.CompleteRelease())
            {
                //
                LiftEndObject(liftObj, false);

                //				// 持ち上げ中オブジェクトの判定と挙動を有効化
                //				liftObj.GetComponent<BoxCollider>().enabled = true;
                //				liftObj.GetComponent<MoveManager>().enabled = true;
                //
                //				// 持ち上げ中のプレイヤー当たり判定を無効化
                //				standbyCol.enabled = true;
                //				liftingCol.enabled = false;
                //
                //				// 持ち上げ中オブジェクトを下ろし切る
                //				MoveManager.MoveTo(liftPoint.position, liftObj.GetComponent<BoxCollider>(), LayerMask.GetMask(new string[] { "" }));
                //				liftObj = null;

                // 待機状態に
                St = LiftState.standby;

                // アニメーション遷移
                PlAnim.ExitRelease();
            }
            break;

        case LiftState.liftUpFailed:
            // 移動不可
            MoveMng.StopMoveVirticalAll();
            MoveMng.StopMoveHorizontalAll();

            // オブジェクトの位置を同期
            if (!MoveManager.MoveTo(PlAnim.GetBoxPosition(), liftObj.GetComponent <BoxCollider>(), liftingColMask))
            {
                Debug.Log("持ち上げ失敗に失敗");

                // 同期できなければ下ろす
                St = LiftState.standby;

                LiftEndObject(liftObj, false);

                // 待機アニメーションへの遷移
                PlAnim.ExitCatchFailed();

                return;
            }

            // 移動不可
            MoveMng.StopMoveVirticalAll();
            MoveMng.StopMoveHorizontalAll();

            // 持ち上げ失敗完了時
            if (PlAnim.CompleteCatchFailed())
            {
                // 下ろし時のオブジェクト挙動を変更
                LiftEndObject(liftObj, false);

                PlAnim.ExitCatchFailed();

                liftObj = null;
            }
            break;

/// ひとまず下ろし失敗状態に遷移する事はない
//		case LiftState.liftDownFailed:
//			// 移動不可
//			MoveMng.StopMoveVirticalAll();
//			MoveMng.StopMoveHorizontalAll();
//
//			// オブジェクトの位置を同期
//			if (!MoveManager.MoveTo(liftPoint.position, liftObj.GetComponent<BoxCollider>(), LayerMask.GetMask(new string[] { "Stage", "Box" }))) {
//				Debug.Log("下ろし失敗");
//
//				// 同期できなければ持ち上げる
//				LiftUp(liftObj);
//				return;
//			}
//
//			// 下ろし完了時
//			if (PlAnim.CompleteRelease()) {
//				// 持ち上げ中オブジェクトの判定と挙動を有効化
//				liftObj.GetComponent<BoxCollider>().enabled = true;
//				liftObj.GetComponent<MoveManager>().enabled = true;
//
//				// 持ち上げ中のプレイヤー当たり判定を無効化
//				standbyCol.enabled = true;
//				liftingCol.enabled = false;
//
//				// 持ち上げ中オブジェクトを下ろし切る
//				MoveManager.MoveTo(liftPoint.position, liftObj.GetComponent<BoxCollider>(), LayerMask.GetMask(new string[] { "" }));
//				liftObj = null;
//			}
//			break;

        case LiftState.lifting:
            // オブジェクトの位置を同期
            MoveManager.MoveTo(PlAnim.GetBoxPosition(), liftObj.GetComponent <BoxCollider>(), liftingColMask);
            break;

        default:
            break;
        }
    }
Ejemplo n.º 3
0
    void UpdateLifting()
    {
        switch (St)
        {
        case LiftState.liftUp:
            // 移動不可
            MoveMng.StopMoveVirticalAll();
            MoveMng.StopMoveHorizontalAll();

            // 持ち上げ中オブジェクトを動かさない
            LiftObjMoveMng.StopMoveVirticalAll();
            LiftObjMoveMng.StopMoveHorizontalAll();

            // 持つオブジェクトの補間位置が現在のオブジェクトより高ければ
            bool liftMoveFlg = false;
            //float landVec = MoveMng.GravityForce;
            //WeightManager liftWeightMng = LiftObj.GetComponent<WeightManager>();
            //// 水中で水に浮く重さなら上方向に接地
            //if (LiftWaterStt && liftWeightMng && LiftWaterStt.IsInWater && !LiftWaterStt.IsWaterSurface && liftWeightMng.WeightLv <= WeightManager.Weight.light) {
            //	landVec = 1.0f;
            //}
            //if (landVec < 0.0f) {   // 接地方向が下
            if (Pl.RotVec.y == 0.0f)
            {
                if (PlAnim.GetBoxPosition().y > LiftObj.transform.position.y)
                {
                    liftMoveFlg = true;
                }
            }
            else                                // 接地方向が上
            {
                if (PlAnim.GetBoxPosition().y < LiftObj.transform.position.y)
                {
                    liftMoveFlg = true;
                }
            }

            // オブジェクトの位置を同期
            if (liftMoveFlg)
            {
                if (heavyFailedFlg || (!MoveManager.Move(GetLiftUpBoxMove(), LiftObj.GetComponent <BoxCollider>(), liftingColMask, false, true) && (Pl.transform.position.x != LiftObj.transform.position.x)))
                {
                    Debug.Log("持ち上げ失敗");

                    //					// 持ち上げ中オブジェクトの強制押し出しフラグを戻す
                    //					LiftObjMoveMng.enabled = false;

                    // 持ち上げ移動中フラグをfalseに
                    LiftObjMoveMng.IsLiftUpMove = false;

                    // 対象をすり抜けオブジェクトに追加
                    MoveMng.AddThroughCollider(LiftObj);

                    // 同期できなければ下ろす
                    St = LiftState.liftUpFailed;

                    // 失敗アニメーションへの遷移
                    PlAnim.FailedCatch();

                    return;
                }

                // プレイヤーのモデルと同じ回転をオブジェクトに加える
                LiftObjModel.transform.rotation = cameraLookTransform.rotation;
            }

            // 持ち上げ完了時
            if (PlAnim.CompleteCatch())
            {
                LiftUpEnd();
                //				// 持ち上げ中オブジェクトの判定と挙動を無効化
                //				LiftObj.GetComponent<BoxCollider>().enabled = false;
                //				LiftObj.GetComponent<MoveManager>().enabled = false;
                //
                //				// 持ち上げ中のプレイヤー当たり判定を有効化
                //				standbyCol.enabled = false;
                //				liftingCol.enabled = true;

                plAnim.ExitCatch();

                //				// 持ち上げ後処理状態
                //				St = LiftState.liftUpAfterHoldInput;
            }
            break;

        case LiftState.liftDown:
//			Debug.LogWarning(St.ToString() + " " + PlAnim.GetBoxPosition());

            // 移動不可
            MoveMng.StopMoveVirticalAll();
            MoveMng.StopMoveHorizontalAll();

            // 持ち上げ中オブジェクトを動かさない
            LiftObjMoveMng.StopMoveVirticalAll();
            LiftObjMoveMng.StopMoveHorizontalAll();

            // 回転終了待ち
            if (liftDownWeit)
            {
                if (Pl.CameraLookRatio == 0.0f)
                {
                    liftDownWeit = false;

                    // 持ち上げ中オブジェクトの判定を有効化
                    LiftObj.GetComponent <BoxCollider>().enabled = true;

                    // 下ろしアニメーションへの遷移
                    PlAnim.StartRelease();

                    // サウンド再生
                    SoundManager.SPlay(liftSE, liftDownSoundDeray);
                }
            }
            else
            {
                // オブジェクトの位置を同期
                if (!MoveManager.MoveTo(GetLiftDownBoxPosition(), LiftObj.GetComponent <BoxCollider>(), liftingColMask))
                {
                    Debug.Log("下ろし失敗");

                    if (Pl.RotVec.y == 1.0f)
                    {
                        Debug.LogWarning("下ろし失敗補正");
                        failedPosUpFlg = true;
                    }

                    LiftDownEnd();

                    // アニメーション遷移
                    PlAnim.ExitRelease();

                    return;
                }
            }

            // プレイヤーのモデルと同じ回転をオブジェクトに加える
            LiftObjModel.transform.rotation = cameraLookTransform.rotation;

            // 下ろし完了時
            if (!liftDownWeit && PlAnim.CompleteRelease())
            {
                Debug.LogWarning("下ろし完了");
                // オブジェクトを離す
                LiftDownEnd();

                //				// 持ち上げ中オブジェクトの判定と挙動を有効化
                //				LiftObj.GetComponent<BoxCollider>().enabled = true;
                //				LiftObj.GetComponent<MoveManager>().enabled = true;
                //
                //				// 持ち上げ中のプレイヤー当たり判定を無効化
                //				standbyCol.enabled = true;
                //				liftingCol.enabled = false;
                //
                //				// 持ち上げ中オブジェクトを下ろし切る
                //				MoveManager.MoveTo(liftPoint.position, LiftObj.GetComponent<BoxCollider>(), LayerMask.GetMask(new string[] { "" }));
                //				LiftObj = null;
                //
                //				// 下ろし処理後状態に
                //				St = LiftState.standby;
                //				afterHoldInput = true;

                // アニメーション遷移
                PlAnim.ExitRelease();
            }
            break;

        case LiftState.liftUpFailed:
            // 移動不可
            MoveMng.StopMoveVirticalAll();
            MoveMng.StopMoveHorizontalAll();

            // 持ち上げ中オブジェクトを動かさない
            LiftObjMoveMng.StopMoveVirticalAll();
            LiftObjMoveMng.StopMoveHorizontalAll();

            // オブジェクトの位置を同期
            if (!MoveManager.MoveTo(GetLiftDownBoxPosition(), LiftObj.GetComponent <BoxCollider>(), liftingColMask))
            {
                Debug.Log("持ち上げ失敗に失敗");

                // オブジェクトを離す
                LiftDownEnd();

                // アニメーション遷移
                PlAnim.ExitRelease();

                return;
            }

            // プレイヤーのモデルと同じ回転をオブジェクトに加える
            LiftObjModel.transform.rotation = cameraLookTransform.rotation;

            // 移動不可
            MoveMng.StopMoveVirticalAll();
            MoveMng.StopMoveHorizontalAll();

            // 持ち上げ失敗完了時
            if (PlAnim.CompleteCatchFailed())
            {
                Debug.Log("持ち上げ失敗完了");
                // 持ち上げオブジェクトを離す
                LiftDownEnd();

                // アニメーション遷移
                PlAnim.ExitCatchFailed();
            }
            break;


/// 現状の仕様では下ろし失敗状態に遷移する事はない
//		case LiftState.liftDownFailed:
//			// 移動不可
//			MoveMng.StopMoveVirticalAll();
//			MoveMng.StopMoveHorizontalAll();
//
//			// オブジェクトの位置を同期
//			if (!MoveManager.MoveTo(liftPoint.position, LiftObj.GetComponent<BoxCollider>(), LayerMask.GetMask(new string[] { "Stage", "Box" }))) {
//				Debug.Log("下ろし失敗");
//
//				// 同期できなければ持ち上げる
//				LiftUp(LiftObj);
//				return;
//			}
//
//			// 下ろし完了時
//			if (PlAnim.CompleteRelease()) {
//				// 持ち上げ中オブジェクトの判定と挙動を有効化
//				LiftObj.GetComponent<BoxCollider>().enabled = true;
//				LiftObj.GetComponent<MoveManager>().enabled = true;
//
//				// 持ち上げ中のプレイヤー当たり判定を無効化
//				standbyCol.enabled = true;
//				liftingCol.enabled = false;
//
//				// 持ち上げ中オブジェクトを下ろし切る
//				MoveManager.MoveTo(liftPoint.position, LiftObj.GetComponent<BoxCollider>(), LayerMask.GetMask(new string[] { "" }));
//				LiftObj = null;
//			}
//			break;

        case LiftState.lifting:
            // オブジェクトの位置を同期
            //			MoveManager.MoveTo(PlAnim.GetBoxPosition(), LiftObj.GetComponent<BoxCollider>(), liftingColMask);
            LiftObj.transform.position = PlAnim.GetBoxPosition();

            // プレイヤーのモデルと同じ回転をオブジェクトに加える
            LiftObjModel.transform.rotation = cameraLookTransform.rotation;

            break;

        default:
            break;
        }
    }