bosuheya chouseimae

This commit is contained in:
ohgushiyuga
2026-07-14 14:14:48 +09:00
parent 568ed162fb
commit 1ab733c127
9 changed files with 161 additions and 42 deletions

View File

@@ -27,13 +27,13 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7127456385706922585} m_GameObject: {fileID: 7127456385706922585}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: -0.7071068} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 83.62, y: -8.22, z: -7.05} m_LocalPosition: {x: 83.62, y: -8.22, z: -7.05}
m_LocalScale: {x: 7, y: 7, z: 7} m_LocalScale: {x: 7, y: 7, z: 7}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 270, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &1825556039889797282 --- !u!33 &1825556039889797282
MeshFilter: MeshFilter:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@@ -1273,8 +1273,8 @@ MonoBehaviour:
features: features:
- {fileID: 7011443450567333355} - {fileID: 7011443450567333355}
- {fileID: -671281728444007487} - {fileID: -671281728444007487}
- {fileID: -901939997048047619} - {fileID: 6956056911768161135}
- {fileID: -1734471456787174204} - {fileID: 5091991234558418143}
- {fileID: 8980318060753866109} - {fileID: 8980318060753866109}
- {fileID: -6559185765804338520} - {fileID: -6559185765804338520}
- {fileID: -4756202077021157709} - {fileID: -4756202077021157709}
@@ -1285,7 +1285,7 @@ MonoBehaviour:
- {fileID: 348827886137839178} - {fileID: 348827886137839178}
- {fileID: -7499073031166464939} - {fileID: -7499073031166464939}
- {fileID: 7666556398442971420} - {fileID: 7666556398442971420}
- {fileID: 431653824124869831} - {fileID: 1118878472687837173}
- {fileID: 3985858319333531581} - {fileID: 3985858319333531581}
- {fileID: -6511185071715886993} - {fileID: -6511185071715886993}
- {fileID: -4363231183632145407} - {fileID: -4363231183632145407}

View File

@@ -702,6 +702,10 @@ MonoBehaviour:
groundAnchor: {fileID: 1519524653} groundAnchor: {fileID: 1519524653}
<AttackRadius>k__BackingField: 10 <AttackRadius>k__BackingField: 10
<JumpRoarDuration>k__BackingField: 5 <JumpRoarDuration>k__BackingField: 5
<CeilingAttackDuration>k__BackingField: 8
<CeilingShotInterval>k__BackingField: 0.2
<WebWarningDelay>k__BackingField: 0.8
<WebDuration>k__BackingField: 3
warningMarkerPrefab: {fileID: 4416133559060049660, guid: bbba2f965a48a1f41aa3aa75745eafc0, type: 3} warningMarkerPrefab: {fileID: 4416133559060049660, guid: bbba2f965a48a1f41aa3aa75745eafc0, type: 3}
webPrefab: {fileID: 7127456385706922585, guid: 6cee7cb816e34c1478e31e98e258a22a, type: 3} webPrefab: {fileID: 7127456385706922585, guid: 6cee7cb816e34c1478e31e98e258a22a, type: 3}
--- !u!195 &139010308 --- !u!195 &139010308
@@ -745,8 +749,8 @@ BoxCollider:
m_ProvidesContacts: 0 m_ProvidesContacts: 0
m_Enabled: 1 m_Enabled: 1
serializedVersion: 3 serializedVersion: 3
m_Size: {x: 2, y: 2, z: 2} m_Size: {x: 1, y: 2, z: 1}
m_Center: {x: 0, y: 0, z: 1.2} m_Center: {x: 0, y: 1, z: 1.8}
--- !u!54 &139010317 --- !u!54 &139010317
Rigidbody: Rigidbody:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -774,6 +778,18 @@ Rigidbody:
m_Interpolate: 0 m_Interpolate: 0
m_Constraints: 0 m_Constraints: 0
m_CollisionDetection: 0 m_CollisionDetection: 0
--- !u!114 &139010320
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 139010306}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d2cd755b0c100204e833df85acb412e8, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::BossDebugController
--- !u!1 &142265989 --- !u!1 &142265989
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -1647,7 +1663,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 400000, guid: d9d1fbfcf69364ffd8f9c6ade9ce90fe, type: 3} - target: {fileID: 400000, guid: d9d1fbfcf69364ffd8f9c6ade9ce90fe, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: -2.3648567 value: -15.8
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 400000, guid: d9d1fbfcf69364ffd8f9c6ade9ce90fe, type: 3} - target: {fileID: 400000, guid: d9d1fbfcf69364ffd8f9c6ade9ce90fe, type: 3}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
@@ -1659,7 +1675,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 400000, guid: d9d1fbfcf69364ffd8f9c6ade9ce90fe, type: 3} - target: {fileID: 400000, guid: d9d1fbfcf69364ffd8f9c6ade9ce90fe, type: 3}
propertyPath: m_LocalRotation.w propertyPath: m_LocalRotation.w
value: 0.9455186 value: 0.98599327
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 400000, guid: d9d1fbfcf69364ffd8f9c6ade9ce90fe, type: 3} - target: {fileID: 400000, guid: d9d1fbfcf69364ffd8f9c6ade9ce90fe, type: 3}
propertyPath: m_LocalRotation.x propertyPath: m_LocalRotation.x
@@ -1667,7 +1683,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 400000, guid: d9d1fbfcf69364ffd8f9c6ade9ce90fe, type: 3} - target: {fileID: 400000, guid: d9d1fbfcf69364ffd8f9c6ade9ce90fe, type: 3}
propertyPath: m_LocalRotation.y propertyPath: m_LocalRotation.y
value: 0.32556805 value: 0.16678526
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 400000, guid: d9d1fbfcf69364ffd8f9c6ade9ce90fe, type: 3} - target: {fileID: 400000, guid: d9d1fbfcf69364ffd8f9c6ade9ce90fe, type: 3}
propertyPath: m_LocalRotation.z propertyPath: m_LocalRotation.z
@@ -1679,7 +1695,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 400000, guid: d9d1fbfcf69364ffd8f9c6ade9ce90fe, type: 3} - target: {fileID: 400000, guid: d9d1fbfcf69364ffd8f9c6ade9ce90fe, type: 3}
propertyPath: m_LocalEulerAnglesHint.y propertyPath: m_LocalEulerAnglesHint.y
value: 38 value: 19.202
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 400000, guid: d9d1fbfcf69364ffd8f9c6ade9ce90fe, type: 3} - target: {fileID: 400000, guid: d9d1fbfcf69364ffd8f9c6ade9ce90fe, type: 3}
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
@@ -1930,7 +1946,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 400000, guid: d9d1fbfcf69364ffd8f9c6ade9ce90fe, type: 3} - target: {fileID: 400000, guid: d9d1fbfcf69364ffd8f9c6ade9ce90fe, type: 3}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
value: 32.56478 value: 31.8
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 400000, guid: d9d1fbfcf69364ffd8f9c6ade9ce90fe, type: 3} - target: {fileID: 400000, guid: d9d1fbfcf69364ffd8f9c6ade9ce90fe, type: 3}
propertyPath: m_LocalRotation.w propertyPath: m_LocalRotation.w
@@ -4302,6 +4318,9 @@ PrefabInstance:
- targetCorrespondingSourceObject: {fileID: 1987720806421918, guid: a2dfe588a42016e40892b72d31fd1cf6, type: 3} - targetCorrespondingSourceObject: {fileID: 1987720806421918, guid: a2dfe588a42016e40892b72d31fd1cf6, type: 3}
insertIndex: -1 insertIndex: -1
addedObject: {fileID: 139010317} addedObject: {fileID: 139010317}
- targetCorrespondingSourceObject: {fileID: 1987720806421918, guid: a2dfe588a42016e40892b72d31fd1cf6, type: 3}
insertIndex: -1
addedObject: {fileID: 139010320}
m_SourcePrefab: {fileID: 100100000, guid: a2dfe588a42016e40892b72d31fd1cf6, type: 3} m_SourcePrefab: {fileID: 100100000, guid: a2dfe588a42016e40892b72d31fd1cf6, type: 3}
--- !u!1001 &1153141912 --- !u!1001 &1153141912
PrefabInstance: PrefabInstance:
@@ -4686,7 +4705,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1030989063, guid: abc00000000014917668085838676610, type: 3} - target: {fileID: 1030989063, guid: abc00000000014917668085838676610, type: 3}
propertyPath: m_LocalScale.x propertyPath: m_LocalScale.x
value: 13 value: 8
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1030989063, guid: abc00000000014917668085838676610, type: 3} - target: {fileID: 1030989063, guid: abc00000000014917668085838676610, type: 3}
propertyPath: m_LocalScale.y propertyPath: m_LocalScale.y
@@ -4694,11 +4713,11 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1030989063, guid: abc00000000014917668085838676610, type: 3} - target: {fileID: 1030989063, guid: abc00000000014917668085838676610, type: 3}
propertyPath: m_LocalScale.z propertyPath: m_LocalScale.z
value: 13 value: 8
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1030989063, guid: abc00000000014917668085838676610, type: 3} - target: {fileID: 1030989063, guid: abc00000000014917668085838676610, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: 99.7 value: 79.7
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1030989063, guid: abc00000000014917668085838676610, type: 3} - target: {fileID: 1030989063, guid: abc00000000014917668085838676610, type: 3}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
@@ -5100,7 +5119,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 0
--- !u!4 &1398221365 --- !u!4 &1398221365
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -5110,7 +5129,7 @@ Transform:
m_GameObject: {fileID: 1398221364} m_GameObject: {fileID: 1398221364}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -0.22, z: -0.32} m_LocalPosition: {x: -0.015, y: -0.22, z: 0.081}
m_LocalScale: {x: 0.45, y: 0.25, z: 0.35} m_LocalScale: {x: 0.45, y: 0.25, z: 0.35}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
@@ -5495,7 +5514,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8806329115733545878, guid: 77e7c27b2c5525e4aa8cc9f99d654486, type: 3} - target: {fileID: 8806329115733545878, guid: 77e7c27b2c5525e4aa8cc9f99d654486, type: 3}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
value: -0.37 value: -0.357
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8806329115733545878, guid: 77e7c27b2c5525e4aa8cc9f99d654486, type: 3} - target: {fileID: 8806329115733545878, guid: 77e7c27b2c5525e4aa8cc9f99d654486, type: 3}
propertyPath: m_LocalRotation.w propertyPath: m_LocalRotation.w

View File

@@ -21,7 +21,16 @@ public class BossController : MonoBehaviour, IDamageble
[SerializeField] public Transform groundAnchor; [SerializeField] public Transform groundAnchor;
[field: SerializeField] public float AttackRadius { get; private set; } = 10f; [field: SerializeField] public float AttackRadius { get; private set; } = 10f;
[field: SerializeField] public float JumpRoarDuration { get; private set; } = 5f; [field: SerializeField] public float JumpRoarDuration { get; private set; } = 5f;
[field: SerializeField] public float CeilingAttackDuration { get; private set; } = 8.0f;
[Tooltip("★新設:糸を降らせる時間間隔(秒)。数値を小さくする(例: 0.1)ほど弾数が激増して密度が上がります")]
[field: SerializeField] public float CeilingShotInterval { get; private set; } = 0.2f;
[Tooltip("★新設:地面に赤マーク(予兆)が出てから、本物の糸が降ってくるまでのタイムラグ(秒)")]
[field: SerializeField] public float WebWarningDelay { get; private set; } = 0.8f;
[Tooltip("★新設:地面に生成された糸が消えずに残り続ける時間(秒)")]
[field: SerializeField] public float WebDuration { get; private set; } = 3.0f;
[SerializeField] private GameObject warningMarkerPrefab; [SerializeField] private GameObject warningMarkerPrefab;
[SerializeField] private GameObject webPrefab; [SerializeField] private GameObject webPrefab;
@@ -38,7 +47,7 @@ public class BossController : MonoBehaviour, IDamageble
// フェーズトリガー // フェーズトリガー
private bool triggered50 = false; private bool triggered50 = false;
private bool triggered25 = false; private bool triggered25 = false;
public bool PendingUltimate { get; set; } = false; public bool PendingUltimate { get; set; } = false;
private void Awake() private void Awake()
{ {
@@ -102,11 +111,11 @@ public class BossController : MonoBehaviour, IDamageble
public void TakeDamage(DamageInfo damageInfo) public void TakeDamage(DamageInfo damageInfo)
{ {
currentHp -= damageInfo.amount; currentHp -= damageInfo.amount;
currentHp = Mathf.Clamp(currentHp, 0, maxHp); currentHp = Mathf.Clamp(currentHp, 0, maxHp);
float hpPercentage = (currentHp / maxHp) * 100f; float hpPercentage = (currentHp / maxHp) * 100f;
Debug.Log($"💥 ボスに { damageInfo.amount} ダメージ。残りHP: {hpPercentage:F1}%"); Debug.Log($"💥 ボスに {damageInfo.amount} ダメージ。残りHP: {hpPercentage:F1}%");
if (hpPercentage <= 25f && !triggered25) if (hpPercentage <= 25f && !triggered25)
{ {
@@ -165,8 +174,11 @@ public class BossController : MonoBehaviour, IDamageble
if (webPrefab != null) if (webPrefab != null)
{ {
GameObject web = Instantiate(webPrefab, pos, Quaternion.identity); Quaternion webRotation = Quaternion.Euler(270f, 0f, 0f);
Destroy(web, duration);
GameObject web = Instantiate(webPrefab, pos + new Vector3(0, 0.5f, 0), webRotation);
Destroy(web, duration);
} }
} }
@@ -180,13 +192,34 @@ public class BossController : MonoBehaviour, IDamageble
Anim.ResetTrigger("Land"); Anim.ResetTrigger("Land");
Anim.ResetTrigger("StunStart"); Anim.ResetTrigger("StunStart");
} }
#region
/// <summary>
/// Unityインスペクターの右上メニューから実行できるデバッグ用コマンドです
/// </summary>
[ContextMenu("🛠️ デバッグ:強制必殺技(天井ジャンプ)")]
public void DebugTriggerUltimate()
{
if (!Application.isPlaying)
{
Debug.LogWarning("⚠️ ゲームが再生中Playモードの時のみ実行可能です。");
return;
}
Debug.Log("🛠️ 【デバッグ操作】必殺技の予約券を発行し、強制的に天井ジャンプステートへ遷移します。");
// 必殺技の発動権をONにし、現在の行動をキャンセルして天井ジャンプへ移行
PendingUltimate = true;
ChangeState<SpiderJumpToCeilingState>();
}
#endregion
} }
/// 共通データboss参照を自動保持し、各子ステートの無駄なコードを極限まで削ります。 /// 共通データboss参照を自動保持し、各子ステートの無駄なコードを極限まで削ります。
public abstract class SpiderStateBase : ISpiderState public abstract class SpiderStateBase : ISpiderState
{ {
protected readonly BossController boss; protected readonly BossController boss;
protected SpiderStateBase(BossController owner) protected SpiderStateBase(BossController owner)
{ {
boss = owner; boss = owner;

View File

@@ -0,0 +1,44 @@
using UnityEngine;
public class BossDebugController : MonoBehaviour
{
private BossController bossController;
private void Awake()
{
// 同一オブジェクトにあるBossControllerを自動取得
bossController = GetComponent<BossController>();
}
private void Update()
{
// ─── ★キーボードの『UUltimate』キーを押したら強制発動 ───
if (Input.GetKeyDown(KeyCode.U))
{
TriggerDebugUltimate();
}
// ─── ついでにあると便利な機能『SStun』キーで即座にパリィスタン ───
if (Input.GetKeyDown(KeyCode.S))
{
TriggerDebugStun();
}
}
private void TriggerDebugUltimate()
{
if (bossController == null) return;
Debug.Log("🛠️ 【キーボードデバッグ】強制的に必殺技(天井ジャンプ)を発動します。");
bossController.PendingUltimate = true;
bossController.ChangeState<SpiderJumpToCeilingState>();
}
private void TriggerDebugStun()
{
if (bossController == null) return;
Debug.Log("🛡️ 【キーボードデバッグ】強制的にパリィスタン(チャンスタイム)を発動します。");
bossController.ChangeState<SpiderStunState>();
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: d2cd755b0c100204e833df85acb412e8

View File

@@ -216,10 +216,11 @@ public class SpiderJumpToCeilingState : SpiderStateBase
} }
} }
// ==========================================
// ■ STATE: CEILING ATTACK (インスペクター無段階調整版)
// ==========================================
public class SpiderCeilingAttackState : SpiderStateBase public class SpiderCeilingAttackState : SpiderStateBase
{ {
private float stateDuration = 7.0f;
private float shotInterval = 0.4f;
private float timer = 0f; private float timer = 0f;
private float shotTimer = 0f; private float shotTimer = 0f;
@@ -227,11 +228,13 @@ public class SpiderCeilingAttackState : SpiderStateBase
public override void EnterState() public override void EnterState()
{ {
timer = stateDuration; // ★リファクタリング:インスペクターで設定した必殺技の長さを適用
timer = boss.CeilingAttackDuration;
shotTimer = 0f; shotTimer = 0f;
boss.Anim.SetBool("IsOnCeiling", true); boss.Anim.SetBool("IsOnCeiling", true);
boss.PendingUltimate = false; boss.PendingUltimate = false;
Debug.Log("🕸️ 蜘蛛ボス:天井から無数の糸を乱射中!"); Debug.Log($"🕸️ 蜘蛛ボス:天井からの乱射開始! 持続時間: {timer}秒 / 発射間隔: {boss.CeilingShotInterval}秒");
} }
public override void ExitState() public override void ExitState()
@@ -247,10 +250,13 @@ public class SpiderCeilingAttackState : SpiderStateBase
timer -= Time.deltaTime; timer -= Time.deltaTime;
shotTimer -= Time.deltaTime; shotTimer -= Time.deltaTime;
// タイマーがゼロになったら発射
if (shotTimer <= 0f) if (shotTimer <= 0f)
{ {
ExecuteRandomWebAttack(); ExecuteRandomWebAttack();
shotTimer = shotInterval;
// ★リファクタリング:インスペクターで設定した間隔(秒)でリセットして弾数を制御
shotTimer = boss.CeilingShotInterval;
} }
if (timer <= 0f) if (timer <= 0f)
@@ -261,6 +267,7 @@ public class SpiderCeilingAttackState : SpiderStateBase
private void ExecuteRandomWebAttack() private void ExecuteRandomWebAttack()
{ {
// インスペクターで設定された半径AttackRadiusを基準にランダム座標を計算
Vector2 randomCircle = Random.insideUnitCircle * boss.AttackRadius; Vector2 randomCircle = Random.insideUnitCircle * boss.AttackRadius;
Vector3 targetGroundPos = new Vector3( Vector3 targetGroundPos = new Vector3(
boss.groundAnchor.position.x + randomCircle.x, boss.groundAnchor.position.x + randomCircle.x,
@@ -268,10 +275,10 @@ public class SpiderCeilingAttackState : SpiderStateBase
boss.groundAnchor.position.z + randomCircle.y boss.groundAnchor.position.z + randomCircle.y
); );
boss.SpawnWarningAndWeb(targetGroundPos, 1.0f, 2.5f); // ★リファクタリング:予兆マークのディレイや糸の生存時間もインスペクターと完全連動
boss.SpawnWarningAndWeb(targetGroundPos, boss.WebWarningDelay, boss.WebDuration);
} }
} }
public class SpiderStunState : SpiderStateBase public class SpiderStunState : SpiderStateBase
{ {
private float stunTimer; private float stunTimer;

View File

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