refactor: 집행개시 시그니처 전용 경로를 BT 일반 패턴 스텝으로 통합
- PatternStepType.ChargeWait 및 ChargeStepData 도입으로 충전/차단 판정을 일반 패턴 스텝으로 표현 - UsePatternByRoleAction에서 IsSignature 분기 완전 제거, 일반 패턴 경로로 통합 - BossCombatBehaviorContext에서 시그니처 전용 메서드 10개 이상 제거 - BossStaggerAction(신규): 충전 차단 성공 시 보스 경직 처리 - SignatureFailureEffectsAction(신규): 차단 실패 시 범위 피해/넉백/다운 적용 - RebuildDrogBehaviorAuthoringGraph에 시그니처 Sequence + outcomeBranch 구조 추가 - 집행개시 에셋 스텝 구성을 ChargeWait(3초) → Skill으로 변경 - BossHealthBarUI 시그니처 UI 비활성화, PlayerSkillDebugMenu 디버그 메서드 제거
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
using Colosseum;
|
||||
using Colosseum.Abnormalities;
|
||||
using Colosseum.AI;
|
||||
using Colosseum.Combat;
|
||||
using Colosseum.Enemy;
|
||||
@@ -27,6 +27,7 @@ public abstract partial class BossPatternActionBase : Action
|
||||
protected SkillController skillController;
|
||||
protected BossCombatBehaviorContext combatBehaviorContext;
|
||||
protected UnityEngine.AI.NavMeshAgent navMeshAgent;
|
||||
protected AbnormalityManager abnormalityManager;
|
||||
|
||||
private BossPatternData activePattern;
|
||||
private GameObject activeTarget;
|
||||
@@ -34,6 +35,13 @@ public abstract partial class BossPatternActionBase : Action
|
||||
private bool isWaiting;
|
||||
private float waitEndTime;
|
||||
|
||||
private bool isChargeWaiting;
|
||||
private float chargeEndTime;
|
||||
private float chargeAccumulatedDamage;
|
||||
private float chargeRequiredDamage;
|
||||
private ChargeStepData activeChargeData;
|
||||
private bool chargeTelegraphApplied;
|
||||
|
||||
/// <summary>
|
||||
/// 액션 시작 시 실제로 실행할 패턴과 대상을 결정합니다.
|
||||
/// </summary>
|
||||
@@ -86,7 +94,23 @@ public abstract partial class BossPatternActionBase : Action
|
||||
if (bossEnemy.IsDead || bossEnemy.IsTransitioning)
|
||||
return Status.Failure;
|
||||
|
||||
if (isWaiting)
|
||||
if (isChargeWaiting)
|
||||
{
|
||||
if (chargeAccumulatedDamage >= chargeRequiredDamage)
|
||||
{
|
||||
EndChargeWait(broken: true);
|
||||
skillController?.CancelSkill(SkillCancelReason.Interrupt);
|
||||
LogDebug($"충전 차단 성공: 누적 {chargeAccumulatedDamage:F1} / 필요 {chargeRequiredDamage:F1}");
|
||||
CombatBalanceTracker.RecordBossEvent("집행 개시 차단 성공");
|
||||
return Status.Failure;
|
||||
}
|
||||
|
||||
if (Time.time < chargeEndTime)
|
||||
return Status.Running;
|
||||
|
||||
EndChargeWait(broken: false);
|
||||
}
|
||||
else if (isWaiting)
|
||||
{
|
||||
if (Time.time < waitEndTime)
|
||||
return Status.Running;
|
||||
@@ -132,8 +156,6 @@ public abstract partial class BossPatternActionBase : Action
|
||||
continue;
|
||||
|
||||
GameObject candidate = player.gameObject;
|
||||
if (Team.IsSameTeam(GameObject, candidate))
|
||||
continue;
|
||||
|
||||
float distance = Vector3.Distance(GameObject.transform.position, candidate.transform.position);
|
||||
if (distance > maxDistance || distance >= nearestDistance)
|
||||
@@ -164,7 +186,8 @@ public abstract partial class BossPatternActionBase : Action
|
||||
if (candidate == null || !candidate.activeInHierarchy)
|
||||
return false;
|
||||
|
||||
if (Team.IsSameTeam(GameObject, candidate))
|
||||
// 보스는 항상 적 팀이므로, 플레이어만 적대 대상으로 간주
|
||||
if (candidate.GetComponent<PlayerNetworkController>() == null)
|
||||
return false;
|
||||
|
||||
IDamageable damageable = candidate.GetComponent<IDamageable>();
|
||||
@@ -198,6 +221,12 @@ public abstract partial class BossPatternActionBase : Action
|
||||
return Status.Running;
|
||||
}
|
||||
|
||||
if (step.Type == PatternStepType.ChargeWait)
|
||||
{
|
||||
StartChargeWait(step);
|
||||
return Status.Running;
|
||||
}
|
||||
|
||||
if (step.Skill == null)
|
||||
{
|
||||
Debug.LogWarning($"[{GetType().Name}] 스킬이 비어 있는 패턴 스텝입니다: {activePattern.PatternName} / Step={currentStepIndex}");
|
||||
@@ -234,6 +263,68 @@ public abstract partial class BossPatternActionBase : Action
|
||||
return Status.Running;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 충전 대기를 시작합니다. 전조 이상상태를 부여하고 데미지 추적을 시작합니다.
|
||||
/// </summary>
|
||||
private void StartChargeWait(PatternStep step)
|
||||
{
|
||||
isChargeWaiting = true;
|
||||
activeChargeData = step.ChargeData;
|
||||
chargeEndTime = Time.time + step.Duration;
|
||||
chargeAccumulatedDamage = 0f;
|
||||
|
||||
float damageRatio = activeChargeData != null ? activeChargeData.RequiredDamageRatio : 0.1f;
|
||||
chargeRequiredDamage = bossEnemy.MaxHealth * damageRatio;
|
||||
chargeTelegraphApplied = false;
|
||||
|
||||
if (enemyBase != null)
|
||||
enemyBase.OnDamageTaken += OnChargeDamageTaken;
|
||||
|
||||
if (activeChargeData != null && activeChargeData.TelegraphAbnormality != null && abnormalityManager != null)
|
||||
{
|
||||
abnormalityManager.ApplyAbnormality(activeChargeData.TelegraphAbnormality, GameObject);
|
||||
chargeTelegraphApplied = true;
|
||||
}
|
||||
|
||||
LogDebug($"충전 대기 시작: 필요 피해={chargeRequiredDamage:F1} / 대기={step.Duration:F1}s");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 충전 대기를 종료합니다. 전조 이상상태를 제거하고 데미지 추적을 해제합니다.
|
||||
/// </summary>
|
||||
private void EndChargeWait(bool broken)
|
||||
{
|
||||
isChargeWaiting = false;
|
||||
|
||||
if (enemyBase != null)
|
||||
enemyBase.OnDamageTaken -= OnChargeDamageTaken;
|
||||
|
||||
if (chargeTelegraphApplied && abnormalityManager != null && activeChargeData != null
|
||||
&& activeChargeData.TelegraphAbnormality != null)
|
||||
{
|
||||
abnormalityManager.RemoveAbnormality(activeChargeData.TelegraphAbnormality);
|
||||
chargeTelegraphApplied = false;
|
||||
}
|
||||
|
||||
if (broken && activeChargeData != null)
|
||||
{
|
||||
combatBehaviorContext.LastChargeStaggerDuration = activeChargeData.StaggerDuration;
|
||||
}
|
||||
|
||||
activeChargeData = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 충전 중 보스가 받은 피해를 누적합니다.
|
||||
/// </summary>
|
||||
private void OnChargeDamageTaken(float damage)
|
||||
{
|
||||
if (!isChargeWaiting || damage <= 0f)
|
||||
return;
|
||||
|
||||
chargeAccumulatedDamage += damage;
|
||||
}
|
||||
|
||||
private bool IsReady()
|
||||
{
|
||||
return bossEnemy != null && enemyBase != null && skillController != null && combatBehaviorContext != null;
|
||||
@@ -255,10 +346,16 @@ public abstract partial class BossPatternActionBase : Action
|
||||
|
||||
if (navMeshAgent == null)
|
||||
navMeshAgent = GameObject.GetComponent<UnityEngine.AI.NavMeshAgent>();
|
||||
|
||||
if (abnormalityManager == null)
|
||||
abnormalityManager = GameObject.GetComponent<AbnormalityManager>();
|
||||
}
|
||||
|
||||
private void ClearRuntimeState()
|
||||
{
|
||||
if (isChargeWaiting)
|
||||
EndChargeWait(broken: false);
|
||||
|
||||
activePattern = null;
|
||||
activeTarget = null;
|
||||
currentStepIndex = 0;
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
|
||||
using Colosseum.Enemy;
|
||||
|
||||
using Unity.Behavior;
|
||||
using Unity.Properties;
|
||||
using UnityEngine;
|
||||
|
||||
using Action = Unity.Behavior.Action;
|
||||
|
||||
/// <summary>
|
||||
/// 보스를 경직시키는 BT 액션입니다.
|
||||
/// 충전 차단 성공 등의 상황에서 사용됩니다.
|
||||
/// 경직 시간은 BossCombatBehaviorContext.LastChargeStaggerDuration에서 읽습니다.
|
||||
/// </summary>
|
||||
[Serializable, GeneratePropertyBag]
|
||||
[NodeDescription(
|
||||
name: "Boss Stagger",
|
||||
story: "보스 경직",
|
||||
category: "Action",
|
||||
id: "d4e5f6a7-1111-2222-3333-888899990000")]
|
||||
public partial class BossStaggerAction : Action
|
||||
{
|
||||
private BossCombatBehaviorContext combatBehaviorContext;
|
||||
private BossEnemy bossEnemy;
|
||||
private EnemyBase enemyBase;
|
||||
private float staggerEndTime;
|
||||
|
||||
protected override Status OnStart()
|
||||
{
|
||||
combatBehaviorContext = GameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
bossEnemy = GameObject.GetComponent<BossEnemy>();
|
||||
enemyBase = GameObject.GetComponent<EnemyBase>();
|
||||
|
||||
if (combatBehaviorContext == null || bossEnemy == null)
|
||||
return Status.Failure;
|
||||
|
||||
float staggerDuration = combatBehaviorContext.LastChargeStaggerDuration;
|
||||
if (staggerDuration <= 0f)
|
||||
return Status.Success;
|
||||
|
||||
UnityEngine.AI.NavMeshAgent navMeshAgent = GameObject.GetComponent<UnityEngine.AI.NavMeshAgent>();
|
||||
if (navMeshAgent != null && navMeshAgent.enabled)
|
||||
{
|
||||
navMeshAgent.isStopped = true;
|
||||
navMeshAgent.ResetPath();
|
||||
}
|
||||
|
||||
if (enemyBase != null && enemyBase.Animator != null)
|
||||
{
|
||||
if (HasAnimatorParameter(enemyBase.Animator, "Hit"))
|
||||
enemyBase.Animator.SetTrigger("Hit");
|
||||
}
|
||||
|
||||
staggerEndTime = Time.time + staggerDuration;
|
||||
return Status.Running;
|
||||
}
|
||||
|
||||
protected override Status OnUpdate()
|
||||
{
|
||||
if (Time.time < staggerEndTime)
|
||||
return Status.Running;
|
||||
|
||||
return Status.Success;
|
||||
}
|
||||
|
||||
protected override void OnEnd()
|
||||
{
|
||||
staggerEndTime = 0f;
|
||||
}
|
||||
|
||||
private static bool HasAnimatorParameter(Animator animator, string parameterName)
|
||||
{
|
||||
if (animator == null || string.IsNullOrEmpty(parameterName))
|
||||
return false;
|
||||
|
||||
AnimatorControllerParameter[] parameters = animator.parameters;
|
||||
for (int i = 0; i < parameters.Length; i++)
|
||||
{
|
||||
AnimatorControllerParameter parameter = parameters[i];
|
||||
if (parameter.type == AnimatorControllerParameterType.Trigger && parameter.name == parameterName)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 062f28443a925e44388bea4cab192d47
|
||||
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
|
||||
using Colosseum.Abnormalities;
|
||||
using Colosseum.AI;
|
||||
using Colosseum.Combat;
|
||||
using Colosseum.Enemy;
|
||||
using Colosseum.Player;
|
||||
|
||||
using Unity.Behavior;
|
||||
using Unity.Properties;
|
||||
using UnityEngine;
|
||||
|
||||
using Action = Unity.Behavior.Action;
|
||||
|
||||
/// <summary>
|
||||
/// 충전 차단에 실패하여 패턴이 완료되었을 때, 전체 플레이어에게 범위 효과를 적용합니다.
|
||||
/// 기존 BossCombatBehaviorContext.ExecuteSignatureFailure()의 BT 노드 이관 버전입니다.
|
||||
/// </summary>
|
||||
[Serializable, GeneratePropertyBag]
|
||||
[NodeDescription(
|
||||
name: "Signature Failure Effects",
|
||||
story: "패턴 완료 범위 효과 적용",
|
||||
category: "Action",
|
||||
id: "c3d4e5f6-1111-2222-3333-777788889999")]
|
||||
public partial class SignatureFailureEffectsAction : Action
|
||||
{
|
||||
private BossCombatBehaviorContext combatBehaviorContext;
|
||||
|
||||
protected override Status OnStart()
|
||||
{
|
||||
combatBehaviorContext = GameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
if (combatBehaviorContext == null)
|
||||
{
|
||||
Debug.LogWarning("[SignatureFailureEffects] BossCombatBehaviorContext를 찾을 수 없습니다.");
|
||||
return Status.Failure;
|
||||
}
|
||||
|
||||
ApplyFailureEffects();
|
||||
return Status.Success;
|
||||
}
|
||||
|
||||
private void ApplyFailureEffects()
|
||||
{
|
||||
float failureDamage = combatBehaviorContext.SignatureFailureDamage;
|
||||
AbnormalityData failureAbnormality = combatBehaviorContext.SignatureFailureAbnormality;
|
||||
float knockbackRadius = combatBehaviorContext.SignatureFailureKnockbackRadius;
|
||||
float downRadius = combatBehaviorContext.SignatureFailureDownRadius;
|
||||
float knockbackSpeed = combatBehaviorContext.SignatureFailureKnockbackSpeed;
|
||||
float knockbackDuration = combatBehaviorContext.SignatureFailureKnockbackDuration;
|
||||
float downDuration = combatBehaviorContext.SignatureFailureDownDuration;
|
||||
|
||||
PlayerNetworkController[] players = UnityEngine.Object.FindObjectsByType<PlayerNetworkController>(FindObjectsSortMode.None);
|
||||
for (int i = 0; i < players.Length; i++)
|
||||
{
|
||||
PlayerNetworkController player = players[i];
|
||||
if (player == null || player.IsDead || !player.gameObject.activeInHierarchy)
|
||||
continue;
|
||||
|
||||
GameObject target = player.gameObject;
|
||||
if (!combatBehaviorContext.IsValidHostileTarget(target))
|
||||
continue;
|
||||
|
||||
player.TakeDamage(failureDamage, GameObject);
|
||||
|
||||
if (failureAbnormality != null)
|
||||
{
|
||||
AbnormalityManager targetAbnormalityManager = target.GetComponent<AbnormalityManager>();
|
||||
targetAbnormalityManager?.ApplyAbnormality(failureAbnormality, GameObject);
|
||||
}
|
||||
|
||||
HitReactionController hitReactionController = target.GetComponent<HitReactionController>();
|
||||
if (hitReactionController == null)
|
||||
continue;
|
||||
|
||||
float distance = Vector3.Distance(GameObject.transform.position, target.transform.position);
|
||||
if (distance <= downRadius)
|
||||
{
|
||||
hitReactionController.ApplyDown(downDuration);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (distance > knockbackRadius)
|
||||
continue;
|
||||
|
||||
Vector3 knockbackDirection = target.transform.position - GameObject.transform.position;
|
||||
knockbackDirection.y = 0f;
|
||||
if (knockbackDirection.sqrMagnitude < 0.0001f)
|
||||
{
|
||||
knockbackDirection = GameObject.transform.forward;
|
||||
}
|
||||
|
||||
hitReactionController.ApplyKnockback(knockbackDirection.normalized * knockbackSpeed, knockbackDuration);
|
||||
}
|
||||
|
||||
CombatBalanceTracker.RecordBossEvent("집행 개시 실패");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f7265ab9f84aaa546849b4e74c7bc669
|
||||
@@ -11,7 +11,8 @@ using UnityEngine;
|
||||
/// 지정된 패턴을 실행하는 범용 액션 노드입니다.
|
||||
/// Pattern 필드에 BossPatternData 에셋을 직접 할당합니다.
|
||||
/// 타겟 해석과 등록은 Condition에서 처리되므로, 이 액션은 순수하게 패턴만 실행합니다.
|
||||
/// 시그니처 패턴은 내부적으로 TryStartSignaturePattern 경로를 사용합니다.
|
||||
/// 시그니처 패턴도 일반 패턴과 동일하게 BossPatternActionBase의 스텝 루프로 실행됩니다.
|
||||
/// ChargeWait 스텝이 차단/완료 판정을 담당합니다.
|
||||
/// </summary>
|
||||
[Serializable, GeneratePropertyBag]
|
||||
[NodeDescription(
|
||||
@@ -25,20 +26,12 @@ public partial class UsePatternByRoleAction : BossPatternActionBase
|
||||
[Tooltip("실행할 패턴")]
|
||||
public BlackboardVariable<BossPatternData> Pattern;
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 패턴 실행 상태 추적
|
||||
/// </summary>
|
||||
private bool signatureStarted;
|
||||
|
||||
protected override Status OnStart()
|
||||
{
|
||||
BossPatternData pattern = Pattern?.Value;
|
||||
if (pattern == null)
|
||||
return Status.Failure;
|
||||
|
||||
if (pattern.IsSignature)
|
||||
return StartSignaturePattern();
|
||||
|
||||
// 타겟 해석은 ResolveStepTarget에서 처리됨
|
||||
// 여기서는 RegisterPatternUse만 호출 (근접 패턴 전용)
|
||||
if (pattern.IsMelee)
|
||||
@@ -53,58 +46,14 @@ public partial class UsePatternByRoleAction : BossPatternActionBase
|
||||
|
||||
protected override Status OnUpdate()
|
||||
{
|
||||
BossPatternData pattern = Pattern?.Value;
|
||||
if (pattern == null)
|
||||
return Status.Failure;
|
||||
|
||||
if (pattern.IsSignature)
|
||||
return UpdateSignaturePattern();
|
||||
|
||||
return base.OnUpdate();
|
||||
}
|
||||
|
||||
protected override void OnEnd()
|
||||
{
|
||||
if (signatureStarted)
|
||||
{
|
||||
signatureStarted = false;
|
||||
return;
|
||||
}
|
||||
|
||||
base.OnEnd();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 패턴 시작
|
||||
/// </summary>
|
||||
private Status StartSignaturePattern()
|
||||
{
|
||||
BossCombatBehaviorContext context = GameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
if (context == null)
|
||||
return Status.Failure;
|
||||
|
||||
GameObject target = Target != null ? Target.Value : null;
|
||||
signatureStarted = context.TryStartSignaturePattern(target);
|
||||
return signatureStarted ? Status.Running : Status.Failure;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 패턴 업데이트
|
||||
/// </summary>
|
||||
private Status UpdateSignaturePattern()
|
||||
{
|
||||
if (!signatureStarted)
|
||||
return Status.Failure;
|
||||
|
||||
BossCombatBehaviorContext context = GameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
if (context == null)
|
||||
return Status.Failure;
|
||||
|
||||
return context.IsSignaturePatternActive
|
||||
? Status.Running
|
||||
: Status.Success;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BossPatternActionBase.TryResolvePattern 구현.
|
||||
/// Condition에서 이미 타겟을 해석했으므로, Target.Value를 그대로 사용합니다.
|
||||
|
||||
@@ -19,9 +19,6 @@ namespace Colosseum.AI.BehaviorActions.Conditions
|
||||
if (pattern == null)
|
||||
return false;
|
||||
|
||||
if (pattern.IsSignature)
|
||||
return IsSignatureReady(gameObject);
|
||||
|
||||
BossCombatBehaviorContext context = gameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
if (context == null)
|
||||
return false;
|
||||
@@ -37,17 +34,5 @@ namespace Colosseum.AI.BehaviorActions.Conditions
|
||||
|
||||
return UsePatternAction.IsPatternReady(gameObject, pattern);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 패턴 전용 준비 여부 확인.
|
||||
/// </summary>
|
||||
private static bool IsSignatureReady(GameObject gameObject)
|
||||
{
|
||||
BossCombatBehaviorContext context = gameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
if (context == null)
|
||||
return false;
|
||||
|
||||
return context.IsSignaturePatternReady();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user