構えの処理を追加

This commit is contained in:
KawakamiKento
2026-05-26 13:45:53 +09:00
parent 17c8750e47
commit 1a78937c4b
4 changed files with 116 additions and 2 deletions

View File

@@ -10,6 +10,8 @@ public class VRInputPunch : MonoBehaviour
[SerializeField] private XRNode controllerNode = XRNode.RightHand;
[SerializeField] private VRInputPoseDetector poseDetector;
[SerializeField] private float minPunchSpeed = 2.0f; //パンチとして判定する最低速度 (m/s)
[SerializeField] private float damageMultiplier = 10.0f; //ダメージ倍率
@@ -56,10 +58,18 @@ public class VRInputPunch : MonoBehaviour
if (damageble != null)
{
DamageInfo info = new DamageInfo();
info.amount = speed * damageMultiplier;
if(poseDetector.IsPosing)
{
info.amount = (speed * damageMultiplier) * 2f;
info.isPoseBonus = true;
}
else
{
info.amount = speed * damageMultiplier;
info.isPoseBonus = false;
}
info.hitPosition = other.transform.position;
info.punchDirection = velocity.normalized; //パンチの進む向き
info.isPoseBonus = false;
damageble.TakeDamage(info);
Debug.Log("パンチ成功 ダメージ: {damage:F1}");