- big pattern grace period 판정을 런타임 헬퍼에서 제거하고 BT 조건/액션 노드로 명시 - Increment/Reset Basic Loop Count 노드 추가 및 BT_Drog 재빌드 반영 - Signature Failure Effects 수치를 BT 노드가 직접 보관하도록 정리
94 lines
3.1 KiB
C#
94 lines
3.1 KiB
C#
using System;
|
|
|
|
using Colosseum.AI;
|
|
using Colosseum.Enemy;
|
|
|
|
using Unity.Behavior;
|
|
using Unity.Properties;
|
|
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// 지정된 패턴을 실행하는 범용 액션 노드입니다.
|
|
/// Pattern 필드에 BossPatternData 에셋을 직접 할당합니다.
|
|
/// 타겟 해석과 등록은 Condition에서 처리되므로, 이 액션은 순수하게 패턴만 실행합니다.
|
|
/// 시그니처 패턴도 일반 패턴과 동일하게 BossPatternActionBase의 스텝 루프로 실행됩니다.
|
|
/// ChargeWait 스텝이 차단/완료 판정을 담당합니다.
|
|
/// </summary>
|
|
[Serializable, GeneratePropertyBag]
|
|
[NodeDescription(
|
|
name: "Use Pattern By Role",
|
|
story: "[Pattern] 패턴 실행",
|
|
category: "Action",
|
|
id: "b2c3d4e5-1111-2222-3333-555566667777")]
|
|
public partial class UsePatternByRoleAction : BossPatternActionBase
|
|
{
|
|
[SerializeReference]
|
|
[Tooltip("실행할 패턴")]
|
|
public BlackboardVariable<BossPatternData> Pattern;
|
|
|
|
[SerializeReference]
|
|
[Tooltip("패턴이 실패 결과로 끝나도 BT 시퀀스를 다음 노드까지 진행합니다.")]
|
|
public BlackboardVariable<bool> ContinueOnResolvedFailure = new BlackboardVariable<bool>(false);
|
|
|
|
/// <summary>
|
|
/// 결과 분기용 패턴은 실패 결과도 다음 노드에서 처리할 수 있게 시퀀스를 유지합니다.
|
|
/// </summary>
|
|
protected override bool ContinueSequenceOnResolvedFailure => ContinueOnResolvedFailure?.Value ?? false;
|
|
|
|
protected override Status OnStart()
|
|
{
|
|
BossPatternData pattern = Pattern?.Value;
|
|
if (pattern == null)
|
|
return Status.Failure;
|
|
|
|
// base.OnStart는 TryResolvePattern → ExecuteCurrentStep 호출
|
|
return base.OnStart();
|
|
}
|
|
|
|
protected override Status OnUpdate()
|
|
{
|
|
return base.OnUpdate();
|
|
}
|
|
|
|
protected override void OnEnd()
|
|
{
|
|
base.OnEnd();
|
|
}
|
|
|
|
/// <summary>
|
|
/// BossPatternActionBase.TryResolvePattern 구현.
|
|
/// Condition에서 이미 타겟을 해석했으므로, Target.Value를 그대로 사용합니다.
|
|
/// </summary>
|
|
protected override bool TryResolvePattern(out BossPatternData pattern, out GameObject target)
|
|
{
|
|
pattern = Pattern?.Value;
|
|
target = Target != null ? Target.Value : null;
|
|
BossBehaviorRuntimeState context = GameObject.GetComponent<BossBehaviorRuntimeState>();
|
|
|
|
if (pattern == null)
|
|
{
|
|
context?.LogDebug(nameof(UsePatternByRoleAction), "실행 실패: Pattern이 비어 있습니다.");
|
|
return false;
|
|
}
|
|
|
|
if (context == null || !context.IsPatternReady(pattern))
|
|
{
|
|
context?.LogDebug(nameof(UsePatternByRoleAction), $"실행 실패: 패턴 준비 안 됨 - {pattern.PatternName}");
|
|
return false;
|
|
}
|
|
|
|
if (target == null)
|
|
{
|
|
context?.LogDebug(nameof(UsePatternByRoleAction), $"실행 실패: 타겟 없음 - {pattern.PatternName}");
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
protected override GameObject ResolveStepTarget(GameObject fallbackTarget)
|
|
{
|
|
return base.ResolveStepTarget(fallbackTarget);
|
|
}
|
|
}
|