- 보스 공통 전투 컨텍스트와 패턴 역할 기반 BT 액션을 추가 - 드로그 패턴 선택을 다운 추가타, 도약, 기본 및 보조 패턴 우선순위 브랜치로 이관 - BT_Drog authoring 그래프를 공통 구조에 맞게 재구성 - 드로그 전용 BT 헬퍼를 정리하고 공통 베이스 액션으로 통합 - 플레이 검증으로 도약, 기본 패턴, 내려찍기, 다운 추가타 루프를 확인
47 lines
1.4 KiB
C#
47 lines
1.4 KiB
C#
using System;
|
|
|
|
using Colosseum.Enemy;
|
|
|
|
using Unity.Behavior;
|
|
using Unity.Properties;
|
|
using UnityEngine;
|
|
|
|
using Action = Unity.Behavior.Action;
|
|
|
|
/// <summary>
|
|
/// 보스의 주 대상을 갱신하는 공통 Behavior Action입니다.
|
|
/// </summary>
|
|
[Serializable, GeneratePropertyBag]
|
|
[NodeDescription(
|
|
name: "Refresh Primary Target",
|
|
story: "보스 주 대상을 [Target]으로 갱신",
|
|
category: "Action",
|
|
id: "b7dbb1fc0c0d451795e9f02d6f4d3930")]
|
|
public partial class RefreshPrimaryTargetAction : Action
|
|
{
|
|
[SerializeReference]
|
|
public BlackboardVariable<GameObject> Target;
|
|
|
|
protected override Status OnStart()
|
|
{
|
|
EnemyBase enemyBase = GameObject.GetComponent<EnemyBase>();
|
|
if (enemyBase == null)
|
|
return Status.Failure;
|
|
|
|
GameObject currentTarget = Target != null ? Target.Value : null;
|
|
float aggroRange = enemyBase.Data != null ? enemyBase.Data.AggroRange : Mathf.Infinity;
|
|
GameObject resolvedTarget = enemyBase.GetHighestThreatTarget(currentTarget, null, aggroRange);
|
|
|
|
if (resolvedTarget == null)
|
|
{
|
|
BossCombatBehaviorContext context = GameObject.GetComponent<BossCombatBehaviorContext>();
|
|
resolvedTarget = context != null ? context.FindNearestLivingTarget() : null;
|
|
}
|
|
|
|
if (Target != null)
|
|
Target.Value = resolvedTarget;
|
|
|
|
return resolvedTarget != null ? Status.Success : Status.Failure;
|
|
}
|
|
}
|