feat: 드로그 BT 및 전투 패턴 재구성
- 드로그 BT를 페이즈 전환, 부활 트리거, 가중치 근접 패턴 중심으로 재구성 - 땅 울리기 및 콤보-기본기1_3 패턴/스킬/이펙트를 추가하고 기존 평타 파생 자산을 정리 - 드로그 행동 검증용 PlayMode/Editor 테스트와 관련 런타임 상태 추적을 추가
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
|
||||
using Unity.Behavior;
|
||||
using Unity.Properties;
|
||||
using UnityEngine;
|
||||
|
||||
using Colosseum.Enemy;
|
||||
|
||||
namespace Colosseum.AI.BehaviorActions.Actions
|
||||
{
|
||||
/// <summary>
|
||||
/// 준비된 후보 패턴 중 하나를 가중치 기반으로 선택하고 즉시 실행합니다.
|
||||
/// </summary>
|
||||
[Serializable, GeneratePropertyBag]
|
||||
[NodeDescription(
|
||||
name: "Use Weighted Ready Pattern",
|
||||
story: "준비된 후보 패턴 중 하나를 가중치 기반으로 선택해 실행",
|
||||
category: "Action",
|
||||
id: "6d4fc6fd-0ccd-4d9a-8b86-c602062f78a7")]
|
||||
public partial class UseWeightedReadyPatternAction : BossPatternActionBase
|
||||
{
|
||||
[SerializeReference] public BlackboardVariable<BossPatternData> Pattern1;
|
||||
[SerializeReference] public BlackboardVariable<float> Weight1 = new BlackboardVariable<float>(1f);
|
||||
[SerializeReference] public BlackboardVariable<BossPatternData> Pattern2;
|
||||
[SerializeReference] public BlackboardVariable<float> Weight2 = new BlackboardVariable<float>(1f);
|
||||
[SerializeReference] public BlackboardVariable<BossPatternData> Pattern3;
|
||||
[SerializeReference] public BlackboardVariable<float> Weight3 = new BlackboardVariable<float>(1f);
|
||||
[SerializeReference] public BlackboardVariable<BossPatternData> Pattern4;
|
||||
[SerializeReference] public BlackboardVariable<float> Weight4 = new BlackboardVariable<float>(1f);
|
||||
[SerializeReference] public BlackboardVariable<BossPatternData> Pattern5;
|
||||
[SerializeReference] public BlackboardVariable<float> Weight5 = new BlackboardVariable<float>(1f);
|
||||
|
||||
private BossPatternData selectedPattern;
|
||||
|
||||
protected override Status OnStart()
|
||||
{
|
||||
if (!TrySelectPattern(out selectedPattern))
|
||||
return Status.Failure;
|
||||
|
||||
BossBehaviorRuntimeState context = GameObject.GetComponent<BossBehaviorRuntimeState>();
|
||||
context?.RegisterPatternUse(selectedPattern);
|
||||
context?.LogDebug(nameof(UseWeightedReadyPatternAction), $"가중치 패턴 선택 후 실행: {selectedPattern.PatternName}");
|
||||
return base.OnStart();
|
||||
}
|
||||
|
||||
protected override void OnEnd()
|
||||
{
|
||||
selectedPattern = null;
|
||||
base.OnEnd();
|
||||
}
|
||||
|
||||
protected override bool TryResolvePattern(out BossPatternData pattern, out GameObject target)
|
||||
{
|
||||
target = Target != null ? Target.Value : null;
|
||||
pattern = selectedPattern;
|
||||
|
||||
if (pattern == null && !TrySelectPattern(out pattern))
|
||||
return false;
|
||||
|
||||
if (target == null)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool TrySelectPattern(out BossPatternData pattern)
|
||||
{
|
||||
WeightedPatternCandidate[] candidates =
|
||||
{
|
||||
new WeightedPatternCandidate(Pattern1?.Value, Weight1?.Value ?? 0f),
|
||||
new WeightedPatternCandidate(Pattern2?.Value, Weight2?.Value ?? 0f),
|
||||
new WeightedPatternCandidate(Pattern3?.Value, Weight3?.Value ?? 0f),
|
||||
new WeightedPatternCandidate(Pattern4?.Value, Weight4?.Value ?? 0f),
|
||||
new WeightedPatternCandidate(Pattern5?.Value, Weight5?.Value ?? 0f),
|
||||
};
|
||||
|
||||
return WeightedPatternSelector.TrySelectReadyPattern(GameObject, candidates, out pattern);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user