parili
This commit is contained in:
@@ -4,7 +4,7 @@ using System.Collections.Generic;
|
||||
|
||||
[RequireComponent(typeof(NavMeshAgent))]
|
||||
[RequireComponent(typeof(Animator))]
|
||||
public class BossController : MonoBehaviour
|
||||
public class BossController : MonoBehaviour, IDamageble
|
||||
{
|
||||
[SerializeField] private float maxHp = 500f;
|
||||
[SerializeField] private float currentHp = 500f;
|
||||
@@ -15,13 +15,12 @@ public class BossController : MonoBehaviour
|
||||
[field: SerializeField] public float ChargeDuration { get; private set; } = 2f;
|
||||
[field: SerializeField] public float ChargeMinimumDistance { get; private set; } = 6f;
|
||||
[field: SerializeField] public float ChargeCooldownDuration { get; private set; } = 4f;
|
||||
[Tooltip("突進する前の、その場での咆哮・溜め時間(秒)")]
|
||||
[field: SerializeField] public float ChargeRoarDuration { get; private set; } = 5f; // ★インスペクターに逃がして保守性を向上
|
||||
[field: SerializeField] public float ChargeRoarDuration { get; private set; } = 5f;
|
||||
|
||||
[SerializeField] public Transform ceilingAnchor;
|
||||
[SerializeField] public Transform groundAnchor;
|
||||
[field: SerializeField] public float AttackRadius { get; private set; } = 10f;
|
||||
[field: SerializeField] public float JumpRoarDuration { get; private set; } = 2f;
|
||||
[field: SerializeField] public float JumpRoarDuration { get; private set; } = 5f;
|
||||
|
||||
[SerializeField] private GameObject warningMarkerPrefab;
|
||||
[SerializeField] private GameObject webPrefab;
|
||||
@@ -101,13 +100,13 @@ public class BossController : MonoBehaviour
|
||||
currentState.EnterState();
|
||||
}
|
||||
|
||||
public void TakeDamage(float damage)
|
||||
public void TakeDamage(DamageInfo damageInfo)
|
||||
{
|
||||
currentHp -= damage;
|
||||
currentHp -= damageInfo.amount;
|
||||
currentHp = Mathf.Clamp(currentHp, 0, maxHp);
|
||||
float hpPercentage = (currentHp / maxHp) * 100f;
|
||||
|
||||
Debug.Log($"💥 ボスに {damage} ダメージ。残りHP: {hpPercentage:F1}%");
|
||||
Debug.Log($"💥 ボスに { damageInfo.amount} ダメージ。残りHP: {hpPercentage:F1}%");
|
||||
|
||||
if (hpPercentage <= 25f && !triggered25)
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ public class SpiderChaseState : SpiderStateBase
|
||||
if (distance >= boss.ChargeMinimumDistance && boss.ChargeCooldownTimer <= 0f)
|
||||
{
|
||||
boss.ChangeState<SpiderChargeState>();
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
// 至近距離噛みつき判定
|
||||
@@ -56,11 +56,11 @@ public class SpiderBiteState : SpiderStateBase
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
stateTimer = 1.5f;
|
||||
|
||||
boss.Agent.ResetPath();
|
||||
boss.Agent.isStopped = true;
|
||||
boss.Agent.velocity = Vector3.zero;
|
||||
stateTimer = 1.5f;
|
||||
|
||||
boss.Agent.ResetPath();
|
||||
boss.Agent.isStopped = true;
|
||||
boss.Agent.velocity = Vector3.zero;
|
||||
|
||||
boss.Anim.SetFloat("Speed", 0f);
|
||||
boss.Anim.SetTrigger("Attack_Bite");
|
||||
@@ -91,12 +91,12 @@ public class SpiderChargeState : SpiderStateBase
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
roarTimer = boss.ChargeRoarDuration;
|
||||
roarTimer = boss.ChargeRoarDuration;
|
||||
chargeTimer = boss.ChargeDuration;
|
||||
isChargingPhase = false;
|
||||
|
||||
boss.Agent.isStopped = true;
|
||||
boss.Agent.velocity = Vector3.zero;
|
||||
boss.Agent.velocity = Vector3.zero;
|
||||
|
||||
boss.ResetChargeCooldown();
|
||||
boss.Anim.SetTrigger("Attack_Roar");
|
||||
@@ -143,9 +143,9 @@ public class SpiderChargeState : SpiderStateBase
|
||||
|
||||
Vector3 targetDestination = boss.transform.position + chargeDirection * 20f;
|
||||
|
||||
boss.Agent.isStopped = false;
|
||||
boss.Agent.speed = boss.ChargeSpeed;
|
||||
boss.Agent.acceleration = 120f;
|
||||
boss.Agent.isStopped = false;
|
||||
boss.Agent.speed = boss.ChargeSpeed;
|
||||
boss.Agent.acceleration = 120f;
|
||||
boss.Agent.SetDestination(targetDestination);
|
||||
|
||||
Debug.Log("🚀 蜘蛛ボス:ロックオン完了。全速力で突進ダッシュを発射!");
|
||||
@@ -174,7 +174,7 @@ public class SpiderJumpToCeilingState : SpiderStateBase
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
roarTimer = boss.JumpRoarDuration;
|
||||
roarTimer = boss.JumpRoarDuration;
|
||||
jumpProgress = 0f;
|
||||
startPos = boss.transform.position;
|
||||
isJumpingPhase = false;
|
||||
@@ -193,7 +193,7 @@ public class SpiderJumpToCeilingState : SpiderStateBase
|
||||
if (roarTimer <= 0f)
|
||||
{
|
||||
isJumpingPhase = true;
|
||||
boss.Anim.SetTrigger("JumpUp");
|
||||
boss.Anim.SetTrigger("JumpUp");
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -218,8 +218,8 @@ public class SpiderJumpToCeilingState : SpiderStateBase
|
||||
|
||||
public class SpiderCeilingAttackState : SpiderStateBase
|
||||
{
|
||||
private float stateDuration = 7.0f;
|
||||
private float shotInterval = 0.4f;
|
||||
private float stateDuration = 7.0f;
|
||||
private float shotInterval = 0.4f;
|
||||
private float timer = 0f;
|
||||
private float shotTimer = 0f;
|
||||
|
||||
@@ -230,7 +230,7 @@ public class SpiderCeilingAttackState : SpiderStateBase
|
||||
timer = stateDuration;
|
||||
shotTimer = 0f;
|
||||
boss.Anim.SetBool("IsOnCeiling", true);
|
||||
boss.PendingUltimate = false;
|
||||
boss.PendingUltimate = false;
|
||||
Debug.Log("🕸️ 蜘蛛ボス:天井から無数の糸を乱射中!");
|
||||
}
|
||||
|
||||
@@ -280,11 +280,12 @@ public class SpiderStunState : SpiderStateBase
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
stunTimer = 4.0f;
|
||||
stunTimer = 4.0f;
|
||||
boss.Anim.SetTrigger("StunStart");
|
||||
boss.Anim.SetBool("IsStunned", true);
|
||||
if (boss.Agent.enabled) boss.Agent.isStopped = true;
|
||||
Debug.Log("🛡️ パリィ成功! チャンスタイム!");
|
||||
|
||||
}
|
||||
|
||||
public override void ExitState()
|
||||
|
||||
@@ -53,41 +53,36 @@ 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}");
|
||||
Debug.Log($"🛡️ [パリィチェック] 敵の拳と接触。構え状態: {poseDetector.IsPosing}");
|
||||
|
||||
// 条件:構え状態(IsPosing)である、もしくは、弾くための速度が一定以上出ている場合
|
||||
if (poseDetector.IsPosing || speed >= minParrySpeed)
|
||||
if (poseDetector.IsPosing)
|
||||
{
|
||||
// 敵の親オブジェクトからEnemyAIスクリプトを検索
|
||||
EnemyAI enemyAI = other.GetComponentInParent<EnemyAI>();
|
||||
if (enemyAI != null)
|
||||
{
|
||||
// 敵の攻撃コンボを強制中断し、スタン状態にする
|
||||
enemyAI.TriggerParryStun(parryStunDuration);
|
||||
|
||||
// パリィ成功用の強力な振動をプレイヤーに返す
|
||||
TriggerHaptics(parryHapticAmplitude, parryHapticDuration);
|
||||
|
||||
Debug.Log($"🛡️ 【ジャストパリィ成功!】 敵の体勢を崩しました。スタン時間: {parryStunDuration}秒");
|
||||
return; // パリィが成立した場合は以降のパンチ処理は行わない
|
||||
return;
|
||||
}
|
||||
|
||||
BossController boss = other.GetComponentInParent<BossController>();
|
||||
if (boss != null)
|
||||
{
|
||||
boss.TriggerParryStun();
|
||||
TriggerHaptics(parryHapticAmplitude, parryHapticDuration);
|
||||
|
||||
Debug.Log("🛡️ 【ジャストパリィ成功!】 ボスの体勢を崩しました!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
BossController boss = other.GetComponentInParent<BossController>();
|
||||
if (boss != null)
|
||||
{
|
||||
// ボスにパリィ成立を通知(噛みつき・突進中であれば自動でスタンへ移行)
|
||||
boss.TriggerParryStun();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("🧱 ガード(または速度不足):敵の攻撃は防いだが、弾き返せなかった。");
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Log("🧱 ガード(構え不足):敵の攻撃は防いだが、弾き返せなかった。");
|
||||
return;
|
||||
}
|
||||
// ────────────────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
// パンチ攻撃の処理
|
||||
|
||||
Reference in New Issue
Block a user