Codingモード研究中
This commit is contained in:
@@ -17,14 +17,10 @@ public class VRInputPunch : MonoBehaviour
|
||||
[SerializeField] private float hapticDuration = 0.1f; // 通常ヒットの振動の長さ
|
||||
|
||||
[Header("パリィ設定")]
|
||||
[Tooltip("パリィを成立させるために必要な最低限の手の速度 (m/s) ※構え中は速度に関係なく成功します")]
|
||||
[SerializeField] private float minParrySpeed = 1.0f;
|
||||
[Tooltip("パリィ成功時に敵がスタン(行動不能)になる時間 (秒)")]
|
||||
[SerializeField] private float parryStunDuration = 3.0f;
|
||||
[Tooltip("パリィ成功時の強力な振動の強さ (0.0 ~ 1.0)")]
|
||||
[SerializeField] private float parryHapticAmplitude = 0.9f;
|
||||
[Tooltip("パリィ成功時の強力な振動の長さ (秒)")]
|
||||
[SerializeField] private float parryHapticDuration = 0.25f;
|
||||
[SerializeField] private float minParrySpeed = 1.0f; // パリィできるパンチとして判定する最低速度 (m/s)
|
||||
[SerializeField] private float parryStunDuration = 3.0f; // スタン時間(秒)
|
||||
[SerializeField] private float parryHapticAmplitude = 0.9f; // パリィ成功時の振動の強さ
|
||||
[SerializeField] private float parryHapticDuration = 0.25f; // パリィ成功時の振動の長さ
|
||||
// ─────────────────────────────────────────
|
||||
|
||||
private void OnEnable()
|
||||
@@ -57,7 +53,7 @@ public class VRInputPunch : MonoBehaviour
|
||||
Vector3 velocity = velocityAction.action.ReadValue<Vector3>();
|
||||
float speed = velocity.magnitude;
|
||||
|
||||
// ─── ★新設:【パリィ判定】当たったオブジェクトが「敵の拳」だった場合 ───
|
||||
//【パリィ判定】当たったオブジェクトが敵の拳だった場合
|
||||
if (other.CompareTag("EnemyFist"))
|
||||
{
|
||||
Debug.Log($"🛡️ [パリィチェック] 敵の拳と接触。プレイヤーの手の速度: {speed:F2} m/s / 構え状態: {poseDetector.IsPosing}");
|
||||
@@ -72,7 +68,7 @@ public class VRInputPunch : MonoBehaviour
|
||||
// 敵の攻撃コンボを強制中断し、スタン状態にする
|
||||
enemyAI.TriggerParryStun(parryStunDuration);
|
||||
|
||||
// パリィ成功用の強力な振動(手応え)をプレイヤーに返す
|
||||
// パリィ成功用の強力な振動をプレイヤーに返す
|
||||
TriggerHaptics(parryHapticAmplitude, parryHapticDuration);
|
||||
|
||||
Debug.Log($"🛡️ 【ジャストパリィ成功!】 敵の体勢を崩しました。スタン時間: {parryStunDuration}秒");
|
||||
@@ -88,7 +84,7 @@ public class VRInputPunch : MonoBehaviour
|
||||
// ────────────────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
// ─── 以下は従来の【パンチ攻撃】の処理(変更なし・ログのバグ修正のみ) ───
|
||||
// パンチ攻撃の処理
|
||||
Debug.Log($"[InputSystem接触] {other.name} に触れました。センサー速度: {speed:F2} m/s");
|
||||
|
||||
if (speed >= minPunchSpeed)
|
||||
@@ -98,6 +94,7 @@ public class VRInputPunch : MonoBehaviour
|
||||
if (damageble != null)
|
||||
{
|
||||
DamageInfo info = new DamageInfo();
|
||||
// 構えからパンチするとダメージ2倍、ゲージ取得度2倍
|
||||
if (poseDetector.IsPosing)
|
||||
{
|
||||
info.amount = (speed * damageMultiplier) * 2f;
|
||||
@@ -114,10 +111,14 @@ public class VRInputPunch : MonoBehaviour
|
||||
}
|
||||
info.hitPosition = other.transform.position;
|
||||
info.punchDirection = velocity.normalized;
|
||||
|
||||
if(PlayerStatusManager.Instance != null)
|
||||
{
|
||||
info.amount *= PlayerStatusManager.Instance.CurrentAttackMultiplier;
|
||||
}
|
||||
|
||||
damageble.TakeDamage(info);
|
||||
|
||||
// ※元のコードのログ出力の記述バグ($の付け忘れ)を修正しました
|
||||
Debug.Log($"パンチ成功 ダメージ: {info.amount:F1}");
|
||||
|
||||
// 通常ヒットの振動を発生
|
||||
@@ -126,14 +127,11 @@ public class VRInputPunch : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
// ※元のコードのログ出力の記述バグ($の付け忘れ)を修正しました
|
||||
Debug.Log($"スピードが足りません。必要: {minPunchSpeed} / 現在: {speed:F2}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 引数に応じて指定された強さと長さでコントローラーを振動させる
|
||||
/// </summary>
|
||||
private void TriggerHaptics(float amplitude, float duration)
|
||||
{
|
||||
UnityEngine.XR.InputDevice device = InputDevices.GetDeviceAtXRNode(controllerNode);
|
||||
|
||||
Reference in New Issue
Block a user