bosuheya chouseimae
This commit is contained in:
@@ -20,6 +20,9 @@ public class VRInputPunch : MonoBehaviour
|
||||
[SerializeField] private float parryStunDuration = 3.0f; // スタン時間(秒)
|
||||
[SerializeField] private float parryHapticAmplitude = 0.9f; // パリィ成功時の振動の強さ
|
||||
[SerializeField] private float parryHapticDuration = 0.25f; // パリィ成功時の振動の長さ
|
||||
// ─── 多段ヒット・連続暴発防止用タイマー ───
|
||||
private float punchHitCooldown = 0f; // 次のパンチが当たるまでのインターバル
|
||||
private float parryTriggerCooldown = 0f; // 次のパリィが成功するまでのインターバル
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
@@ -51,40 +54,51 @@ public class VRInputPunch : MonoBehaviour
|
||||
Vector3 velocity = velocityAction.action.ReadValue<Vector3>();
|
||||
float speed = velocity.magnitude;
|
||||
|
||||
// ========================================================================
|
||||
// 【パリィ判定】当たったオブジェクトが敵の拳だった場合
|
||||
// ========================================================================
|
||||
if (other.CompareTag("EnemyFist"))
|
||||
{
|
||||
Debug.Log($"🛡️ [パリィチェック] 敵の拳と接触。構え状態: {poseDetector.IsPosing}");
|
||||
|
||||
// 自分が「構え状態」のときだけパリィの成立チェックを行う
|
||||
if (poseDetector.IsPosing)
|
||||
{
|
||||
// 1. ザコ敵(EnemyAI)へのパリィ判定
|
||||
EnemyAI enemyAI = other.GetComponentInParent<EnemyAI>();
|
||||
if (enemyAI != null)
|
||||
{
|
||||
enemyAI.TriggerParryStun(parryStunDuration);
|
||||
TriggerHaptics(parryHapticAmplitude, parryHapticDuration);
|
||||
|
||||
Debug.Log($"🛡️ 【ジャストパリィ成功!】 敵の体勢を崩しました。スタン時間: {parryStunDuration}秒");
|
||||
return;
|
||||
Debug.Log($"🛡️ 【ジャストパリィ成功!】 敵の体勢を崩しました。");
|
||||
return; // ★本当のパリィ成功時のみ、ここで処理を終了する
|
||||
}
|
||||
|
||||
// 2. ボス(BossController)へのパリィ判定
|
||||
BossController boss = other.GetComponentInParent<BossController>();
|
||||
if (boss != null)
|
||||
{
|
||||
if(boss.TriggerParryStun())
|
||||
// ★リファクタリング:ボスが本当に攻撃中(Bite/Charge)で、パリィが成功した時だけ終了する
|
||||
if (boss.TriggerParryStun())
|
||||
{
|
||||
TriggerHaptics(parryHapticAmplitude, parryHapticDuration);
|
||||
|
||||
Debug.Log("🛡️ 【ジャストパリィ成功!】 ボスの体勢を崩しました!");
|
||||
return;
|
||||
TriggerHaptics(parryHapticAmplitude, parryHapticDuration);
|
||||
Debug.Log("🛡️ 【ジャストパリィ成功!】 ボスの体勢を崩しました!");
|
||||
return; // ★本当のパリィ成功時のみ、ここで処理を終了する
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log("🧱 ガード(構え不足):敵の攻撃は防いだが、弾き返せなかった。");
|
||||
// ─── ★ここが今回の核心(超重要リファクタリング) ───
|
||||
// 構え状態ではなかった場合、またはボスが攻撃中でなくパリィが不成立だった場合は、
|
||||
// 「プレイヤーが隙を狙って殴りに行った」とみなして、returnせずにそのまま下のパンチ処理へ流す!
|
||||
Debug.Log("🥊 パリィ不成立、または攻撃チャンス:通常のパンチダメージ処理へ移行します。");
|
||||
}
|
||||
// ────────────────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
// パンチ攻撃の処理
|
||||
// ========================================================================
|
||||
// 【パンチ攻撃の処理】
|
||||
// ========================================================================
|
||||
Debug.Log($"[InputSystem接触] {other.name} に触れました。センサー速度: {speed:F2} m/s");
|
||||
|
||||
if (speed >= minPunchSpeed)
|
||||
|
||||
Reference in New Issue
Block a user