feat: 보스 공통 패턴 간격 추가

- BossBehaviorRuntimeState에 패턴 종료 후 공통 텀과 준비 판정을 추가\n- UsePatternAction이 런타임 패턴 실행 결과와 공통 텀을 함께 사용하도록 정리\n- 드로그 PlayMode 테스트에 패턴 종료 후 공통 간격 검증 케이스를 추가
This commit is contained in:
2026-04-10 07:57:15 +09:00
parent 4ba6d9d9ff
commit b019acd0a3
3 changed files with 120 additions and 7 deletions

View File

@@ -27,6 +27,7 @@ public partial class UsePatternAction : Action
new System.Collections.Generic.Dictionary<string, float>();
private SkillController skillController;
private BossBehaviorRuntimeState runtimeState;
private int currentStepIndex;
private float waitEndTime;
private bool isWaiting;
@@ -65,6 +66,9 @@ public partial class UsePatternAction : Action
return Status.Failure;
}
runtimeState = GameObject.GetComponent<BossBehaviorRuntimeState>();
runtimeState?.BeginPatternExecution(Pattern.Value);
currentStepIndex = 0;
isWaiting = false;
isSkillStepExecuting = false;
@@ -74,7 +78,7 @@ public partial class UsePatternAction : Action
protected override Status OnUpdate()
{
if (skillController == null)
return Status.Failure;
return FinalizePatternFailure(BossPatternExecutionResult.Cancelled);
if (isWaiting)
{
@@ -92,7 +96,7 @@ public partial class UsePatternAction : Action
isSkillStepExecuting = false;
if (skillController.LastExecutionResult != SkillExecutionResult.Completed)
return Status.Failure;
return FinalizePatternFailure(BossPatternExecutionResult.Cancelled);
}
else if (skillController.IsPlayingAnimation)
return Status.Running;
@@ -102,8 +106,7 @@ public partial class UsePatternAction : Action
if (currentStepIndex >= Pattern.Value.Steps.Count)
{
MarkPatternUsed(GameObject, Pattern.Value);
return Status.Success;
return FinalizePatternSuccess();
}
return ExecuteCurrentStep();
@@ -112,6 +115,7 @@ public partial class UsePatternAction : Action
protected override void OnEnd()
{
skillController = null;
runtimeState = null;
isSkillStepExecuting = false;
}
@@ -130,7 +134,7 @@ public partial class UsePatternAction : Action
if (step.Skill == null)
{
Debug.LogWarning($"[UsePatternAction] 스킬이 null입니다. (index {currentStepIndex})");
return Status.Failure;
return FinalizePatternFailure(BossPatternExecutionResult.Failed);
}
GameObject jumpTarget = null;
@@ -139,7 +143,7 @@ public partial class UsePatternAction : Action
jumpTarget = ResolveJumpTarget();
if (jumpTarget == null)
{
return Status.Failure;
return FinalizePatternFailure(BossPatternExecutionResult.Failed);
}
}
@@ -150,7 +154,7 @@ public partial class UsePatternAction : Action
if (!success)
{
Debug.LogWarning($"[UsePatternAction] 스킬 실행 실패: {step.Skill.SkillName} (index {currentStepIndex})");
return Status.Failure;
return FinalizePatternFailure(BossPatternExecutionResult.Failed);
}
isSkillStepExecuting = true;
@@ -222,6 +226,10 @@ public partial class UsePatternAction : Action
if (owner == null || pattern == null)
return false;
BossBehaviorRuntimeState context = owner.GetComponent<BossBehaviorRuntimeState>();
if (context != null)
return context.IsPatternReady(pattern);
string cooldownKey = BuildCooldownKey(owner, pattern);
if (!patternReadyTimes.TryGetValue(cooldownKey, out float readyTime))
return true;
@@ -237,6 +245,14 @@ public partial class UsePatternAction : Action
if (owner == null || pattern == null)
return;
BossBehaviorRuntimeState context = owner.GetComponent<BossBehaviorRuntimeState>();
if (context != null)
{
context.SetPatternCooldown(pattern);
context.CompletePatternExecution(pattern, BossPatternExecutionResult.Succeeded);
return;
}
string cooldownKey = BuildCooldownKey(owner, pattern);
patternReadyTimes[cooldownKey] = Time.time + pattern.Cooldown;
}
@@ -251,4 +267,25 @@ public partial class UsePatternAction : Action
BossBehaviorRuntimeState context = GameObject.GetComponent<BossBehaviorRuntimeState>();
context?.LogDebug(nameof(UsePatternAction), message);
}
private Status FinalizePatternSuccess()
{
if (runtimeState != null)
{
runtimeState.SetPatternCooldown(Pattern.Value);
runtimeState.CompletePatternExecution(Pattern.Value, BossPatternExecutionResult.Succeeded);
}
else
{
MarkPatternUsed(GameObject, Pattern.Value);
}
return Status.Success;
}
private Status FinalizePatternFailure(BossPatternExecutionResult result)
{
runtimeState?.CompletePatternExecution(Pattern.Value, result);
return Status.Failure;
}
}