Ejemplo n.º 1
0
    void HandSpringJump()
    {
        // 前回までの上下方向の加速度を削除
        MoveMng.StopMoveVirtical(MoveManager.MoveType.prevMove);

        // 左右方向の移動量をジャンプ中速度まで下げる
        MoveMng.PrevMove = new Vector3(Mathf.Sign(MoveMng.PrevMove.x) * Mathf.Clamp(MoveMng.PrevMove.x, -JumpSpd, JumpSpd), MoveMng.PrevMove.y, MoveMng.PrevMove.z);

        // 離地方向に跳ねる
        if (!WaterStt.IsInWater)
        {
            MoveMng.AddMove(new Vector3(0.0f, (HandSpringJumpHeight) * -(RotVec.y * 2.0f - 1.0f), 0.0f));
        }
        else
        {
            MoveMng.AddMove(new Vector3(0.0f, (HandSpringJumpHeightInWater) * -(RotVec.y * 2.0f - 1.0f), 0.0f));
        }

        // 離地
        Land.IsLanding          = false;
        WaterStt.IsWaterSurface = false;
        WaterStt.BeginWaterStopIgnore();

        // サウンド再生
        SoundManager.SPlay(handSpringJumpSE, handSpringJumpSEDeray);
    }
Ejemplo n.º 2
0
    bool Jump()
    {
        if (!useManualJump)
        {
            return(false);
        }
        if (IsHandSpringWeit)
        {
            return(false);
        }

        // ジャンプ入力(トリガー)がなければ
        if (!jumpStandbyFlg || prevJumpStandbyFlg)
        {
            return(false);
        }
        // ジャンプ可能でなければ
        if (!canJump)
        {
            return(false);
        }
        // 天井反転中なら
        if (IsHandSpring)
        {
            return(false);
        }

        // 着地していなければ
        if (!IsLanding && !WaterStt.IsWaterSurface && !Land.IsWaterFloatLanding)
        {
            return(false);
        }

        // 水面で安定した瞬間であれば
        if (WaterStt.IsWaterSurfaceChange && WaterStt.IsWaterSurface)
        {
            return(false);
        }

        // ステージに接地、又は水面で安定していなければ
        //		Debug.LogWarning("IsLanding:" + Land.IsLanding);
        //if (!Land.IsLanding && !WaterStt.IsWaterSurface) {
        if (!(Land.IsLanding || WaterStt.IsWaterSurface))
        {
            // 接地、又は安定しているオブジェクトにも接地していなければ
            List <Transform> pileObjs  = Pile.GetPileBoxList(new Vector3(0.0f, MoveMng.GravityForce, 0.0f));
            bool             stagePile = false;
            foreach (var pileObj in pileObjs)
            {
                Landing    pileLand     = pileObj.GetComponent <Landing>();
                WaterState pileWaterStt = pileObj.GetComponent <WaterState>();
                //				WaterState pileWaterStt = pileObj.GetComponent<WaterState>();
                //				if ((pileLand && (pileLand.IsLanding || pileLand.IsExtrusionLanding)) || (pileWaterStt && (pileWaterStt.IsWaterSurface))) {
                if ((pileLand && (pileLand.IsLanding || pileLand.IsExtrusionLanding || pileWaterStt.IsWaterSurface)))
                {
                    stagePile = true;
                    break;
                }
            }
            if ((pileObjs.Count == 0) || !stagePile)
            {
                // ジャンプ不可
                return(false);
            }
        }

        // 水面の場合
        if (WaterStt.IsWaterSurface)
        {
            // 自身の上にオブジェクトが乗っていればジャンプできない
            if (Pile.GetPileBoxList(Vector3.up).Count > 0)
            {
                return(false);
            }
        }

        // ジャンプ直後であれば
        //		if (jumpLimitTime > Time.time) return;

        Debug.Log("Jump");

        // パーティクル生成
        if (IsLanding)
        {
            GetComponent <GeneratePlayerJumpJet>().GenerateInGroundEffect();
        }
        else if (WaterStt.IsWaterSurface)
        {
            GetComponent <GeneratePlayerJumpJet>().GenerateInWaterSurfaceEffect();
        }
        else
        {
            GetComponent <GeneratePlayerJumpJet>().GenerateInWaterEffect();
        }

        // ジャンプアニメーション
        if (!Lift.IsLifting)
        {
            PlAnim.StartJump();
        }
        else
        {
            PlAnim.StartHoldJump();
        }

        if (!WaterStt.IsWaterSurface)
        {
            // サウンド再生
            SoundManager.SPlay(jumpSE, jumpSEDeray);
        }

        // 前回までの上下方向の加速度を削除
        MoveMng.StopMoveVirtical(MoveManager.MoveType.prevMove);

        // 左右方向の移動量をジャンプ中速度まで下げる
        MoveMng.PrevMove = new Vector3(Mathf.Clamp(MoveMng.PrevMove.x, -JumpSpd, JumpSpd), MoveMng.PrevMove.y, MoveMng.PrevMove.z);

        // 左右方向の加速度を削除
        //		MoveMng.StopMoveHorizontalAll();

        // 左右方向の移動量も一更新だけ制限
        //		MoveMng.OneTimeMaxSpd = jumpStartOneTimeLimitSpd;

        // 上方向へ加速
        //float jumpGravityForce = (0.5f * Mathf.Pow(jumpTime * 0.5f, 2) + jumpHeight);	// ジャンプ中の重力加速度
        //		float jumpGravityForce = -100;   // ジャンプ中の重力加速度

        //		MoveMng.AddMove(new Vector3(0.0f, (-jumpGravityForce * JumpTime * 0.5f), 0.0f));
        //		Debug.Log(jumpGravityForce);

        // 離地方向に移動
        if (!WaterStt.IsInWater || WaterStt.IsWaterSurface)
        {
//			Debug.LogWarning("landJump");
            MoveMng.AddMove(new Vector3(0.0f, (JumpHeight), 0.0f));
        }
        else
        {
//			Debug.LogWarning("inWaterJump");
            MoveMng.AddMove(new Vector3(0.0f, (JumpHeightInWater), 0.0f));
        }

        // 離地
        Land.IsLanding          = false;
        WaterStt.IsWaterSurface = false;
        WaterStt.BeginWaterStopIgnore();

        //// ジャンプ入力を無効化
        //prevJumpStandbyFlg = jumpStandbyFlg;
        //jumpStandbyFlg = false;

        // 通常の重力加速度を一時的に無効
        //MoveMng.GravityCustomTime = (Time.time + JumpTime);
        //MoveMng.GravityForce = jumpGravityForce;

        // 次回ジャンプ可能時間を設定
        //		jumpLimitTime = Time.time + jumpTime * 0.5f;	// ジャンプしてからジャンプ滞空時間の半分の時間まではジャンプ不可

        return(true);
    }
Ejemplo n.º 3
0
    //	}

    void ClimbJump()
    {
        if (!useAutoClimbJump)
        {
            return;
        }

        // 持ち上げ中や持ち上げ入力があれば処理しない
        //		if (Lift.IsLifting || (Input.GetAxis("Lift") != 0.0f)) return;
        if (Lift.IsLifting || (VirtualController.GetAxis(VirtualController.CtrlCode.Lift) != 0.0f))
        {
            return;
        }

        // ジャンプ可能でなければ処理しない
        if (!canJump)
        {
            return;
        }

        // 接地中でも水上安定中でもなく、水上安定中ブロックに乗ってもいなければ処理しない
        if (!Land.IsLanding && !WaterStt.IsWaterSurface && !Land.IsWaterFloatLanding)
        {
            return;
        }

        // 左右への移動入力がなければ処理しない
        if (walkStandbyVec == 0.0f)
        {
            return;
        }

        // 自動ジャンプ判定がなければ処理しない
        if ((ClimbJumpWeightLvCollider == null) || (ClimbJumpWeightLvCollider.Count <= (int)WeightMng.WeightLv) || (ClimbJumpWeightLvCollider[(int)WeightMng.WeightLv] == null) ||
            (ClimbJumpWeightLvInWaterCollider == null) || (ClimbJumpWeightLvInWaterCollider.Count <= (int)WeightMng.WeightLv) || (ClimbJumpWeightLvInWaterCollider[(int)WeightMng.WeightLv] == null))
        {
            return;
        }

        Transform climbJumpCol;

        if (!WaterStt.IsInWater)
        {
            climbJumpCol = ClimbJumpWeightLvCollider[(int)WeightMng.WeightLv];
        }
        else
        {
            climbJumpCol = ClimbJumpWeightLvInWaterCollider[(int)WeightMng.WeightLv];
        }

        // 自動ジャンプ判定内に対象オブジェクトがなければ処理しない
        if (Physics.OverlapBox(climbJumpCol.transform.position,
                               climbJumpCol.lossyScale * 0.5f,
                               climbJumpCol.rotation, climbJumpMask).Length <= 0)
        {
            return;
        }

        // 現在の向きと移動入力方向が異なれば処理しない
        if (Vector3.Dot((climbJumpCol.position - transform.position), (Vector3.right * walkStandbyVec)) <= 0.0f)
        {
            return;
        }

        // ジャンプアニメーション
        if (!Lift.IsLifting)
        {
            PlAnim.StartJump();
        }
        else
        {
            PlAnim.StartHoldJump();
        }

        // 前回までの上下方向の加速度を削除
        MoveMng.StopMoveVirtical(MoveManager.MoveType.prevMove);

        // 左右方向の移動量も一更新だけ制限
        MoveMng.OneTimeMaxSpd = jumpStartOneTimeLimitSpd;

        // 上方向へ加速
        if (!WaterStt.IsInWater)
        {
            MoveMng.AddMove(new Vector3(0.0f, ClimbJumpWeightLvHeight[(int)WeightMng.WeightLv], 0.0f));
        }
        // 水中
        else
        {
            MoveMng.AddMove(new Vector3(0.0f, ClimbJumpWeightLvHeightInWater[(int)WeightMng.WeightLv], 0.0f));
        }

        // 離地
        Land.IsLanding          = false;
        WaterStt.IsWaterSurface = false;
        WaterStt.BeginWaterStopIgnore();
    }
Ejemplo n.º 4
0
    bool Jump()
    {
        // ジャンプ入力(トリガー)がなければ
        if (!jumpStandbyFlg || prevJumpStandbyFlg)
        {
            return(false);
        }

        // ジャンプ可能でなければ
        if (!canJump)
        {
            return(false);
        }

        // ステージに接地、又は水面で安定していなければ
        Debug.LogWarning("IsLanding:" + Land.IsLanding);
        //if (!Land.IsLanding && !WaterStt.IsWaterSurface) {
        if (!(Land.IsLanding || WaterStt.IsWaterSurface))
        {
            PileWeight pile = GetComponent <PileWeight>();
            // 接地、又は安定しているオブジェクトにも接地していなければ
            List <Transform> pileObjs  = pile.GetPileBoxList(new Vector3(0.0f, MoveMng.GravityForce, 0.0f));
            bool             stagePile = false;
            foreach (var pileObj in pileObjs)
            {
                Landing    pileLand     = pileObj.GetComponent <Landing>();
                WaterState pileWaterStt = pileObj.GetComponent <WaterState>();
                if ((pileLand && (pileLand.IsLanding || pileLand.IsExtrusionLanding)) || (pileWaterStt && (pileWaterStt.IsWaterSurface)))
                {
                    stagePile = true;
                }
            }
            if ((pileObjs.Count == 0) || !stagePile)
            {
                // ジャンプ不可
                return(false);
            }
        }

        // ジャンプ直後であれば
        //		if (jumpLimitTime > Time.time) return;

        Debug.Log("Jump");

        // ジャンプアニメーション
        if (!Lift.IsLifting)
        {
            PlAnim.StartJump();
        }
        else
        {
            PlAnim.StartHoldJump();
        }

        // 前回までの上下方向の加速度を削除
        MoveMng.StopMoveVirtical(MoveManager.MoveType.prevMove);

        // 左右方向の加速度を削除
        //		MoveMng.StopMoveHorizontalAll();

        // 左右方向の移動量も一更新だけ制限
        MoveMng.OneTimeMaxSpd = jumpStartOneTimeLimitSpd;

        // 上方向へ加速
        //float jumpGravityForce = (0.5f * Mathf.Pow(jumpTime * 0.5f, 2) + jumpHeight);	// ジャンプ中の重力加速度
        //		float jumpGravityForce = -100;   // ジャンプ中の重力加速度

        //		MoveMng.AddMove(new Vector3(0.0f, (-jumpGravityForce * JumpTime * 0.5f), 0.0f));
        //		Debug.Log(jumpGravityForce);

        MoveMng.AddMove(new Vector3(0.0f, (JumpHeight), 0.0f));

        // 離地
        Land.IsLanding          = false;
        WaterStt.IsWaterSurface = false;
        WaterStt.BeginWaterStopIgnore();

        // ジャンプ入力を無効化
        jumpStandbyFlg = false;

        // 通常の重力加速度を一時的に無効
        //MoveMng.GravityCustomTime = (Time.time + JumpTime);
        //MoveMng.GravityForce = jumpGravityForce;

        // 次回ジャンプ可能時間を設定
        //		jumpLimitTime = Time.time + jumpTime * 0.5f;	// ジャンプしてからジャンプ滞空時間の半分の時間まではジャンプ不可

        return(true);
    }