feat: 드로그 보스 AI 및 런타임 상태 구조 재구성
- 드로그 전투 컨텍스트를 BossBehaviorRuntimeState 중심 구조로 정리하고 BossEnemy, 패턴 액션, 조건 노드가 마지막 실행 결과와 phase 상태를 직접 사용하도록 갱신 - BT_Drog와 재빌드 에디터 스크립트를 확장해 phase 전환, 집행 결과 분기, 거리/쿨타임 기반 패턴 선택을 드로그 전용 자산과 노드 파라미터로 재구성 - 드로그 패턴/스킬/이펙트/애니메이션 플레이스홀더 자산을 재생성하고 보스 프리팹이 새 런타임 상태 및 등록 클립 구성을 참조하도록 정리
This commit is contained in:
@@ -25,7 +25,7 @@ public abstract partial class BossPatternActionBase : Action
|
||||
protected BossEnemy bossEnemy;
|
||||
protected EnemyBase enemyBase;
|
||||
protected SkillController skillController;
|
||||
protected BossCombatBehaviorContext combatBehaviorContext;
|
||||
protected BossBehaviorRuntimeState runtimeState;
|
||||
protected UnityEngine.AI.NavMeshAgent navMeshAgent;
|
||||
protected AbnormalityManager abnormalityManager;
|
||||
|
||||
@@ -34,6 +34,7 @@ public abstract partial class BossPatternActionBase : Action
|
||||
private int currentStepIndex;
|
||||
private bool isWaiting;
|
||||
private float waitEndTime;
|
||||
private bool isSkillStepExecuting;
|
||||
|
||||
private bool isChargeWaiting;
|
||||
private float chargeEndTime;
|
||||
@@ -47,6 +48,11 @@ public abstract partial class BossPatternActionBase : Action
|
||||
/// </summary>
|
||||
protected abstract bool TryResolvePattern(out BossPatternData pattern, out GameObject target);
|
||||
|
||||
/// <summary>
|
||||
/// 패턴이 의미 있는 결과와 함께 종료되었을 때, 실패 결과도 다음 노드로 넘길지 결정합니다.
|
||||
/// </summary>
|
||||
protected virtual bool ContinueSequenceOnResolvedFailure => false;
|
||||
|
||||
protected override Status OnStart()
|
||||
{
|
||||
ResolveReferences();
|
||||
@@ -55,13 +61,13 @@ public abstract partial class BossPatternActionBase : Action
|
||||
if (!IsReady())
|
||||
return Status.Failure;
|
||||
|
||||
if (combatBehaviorContext.IsBehaviorSuppressed)
|
||||
if (runtimeState.IsBehaviorSuppressed)
|
||||
{
|
||||
StopMovement();
|
||||
return Status.Failure;
|
||||
}
|
||||
|
||||
if (bossEnemy.IsDead || bossEnemy.IsTransitioning)
|
||||
if (bossEnemy.IsDead)
|
||||
return Status.Failure;
|
||||
|
||||
if (skillController.IsPlayingAnimation)
|
||||
@@ -72,10 +78,16 @@ public abstract partial class BossPatternActionBase : Action
|
||||
|
||||
activePattern = pattern;
|
||||
activeTarget = target;
|
||||
runtimeState.BeginPatternExecution(activePattern);
|
||||
|
||||
runtimeState.WasChargeBroken = false;
|
||||
runtimeState.LastChargeStaggerDuration = 0f;
|
||||
|
||||
if (Target != null)
|
||||
Target.Value = target;
|
||||
|
||||
runtimeState.SetCurrentTarget(target);
|
||||
|
||||
StopMovement();
|
||||
return ExecuteCurrentStep();
|
||||
}
|
||||
@@ -83,16 +95,16 @@ public abstract partial class BossPatternActionBase : Action
|
||||
protected override Status OnUpdate()
|
||||
{
|
||||
if (!IsReady() || activePattern == null)
|
||||
return Status.Failure;
|
||||
return FinalizePatternFailure(BossPatternExecutionResult.Failed);
|
||||
|
||||
if (combatBehaviorContext.IsBehaviorSuppressed)
|
||||
if (runtimeState.IsBehaviorSuppressed)
|
||||
{
|
||||
StopMovement();
|
||||
return Status.Failure;
|
||||
return FinalizePatternFailure(BossPatternExecutionResult.Cancelled);
|
||||
}
|
||||
|
||||
if (bossEnemy.IsDead || bossEnemy.IsTransitioning)
|
||||
return Status.Failure;
|
||||
if (bossEnemy.IsDead)
|
||||
return FinalizePatternFailure(BossPatternExecutionResult.Cancelled);
|
||||
|
||||
if (isChargeWaiting)
|
||||
{
|
||||
@@ -100,9 +112,11 @@ public abstract partial class BossPatternActionBase : Action
|
||||
{
|
||||
EndChargeWait(broken: true);
|
||||
skillController?.CancelSkill(SkillCancelReason.Interrupt);
|
||||
runtimeState.WasChargeBroken = true;
|
||||
runtimeState.SetPatternCooldown(activePattern);
|
||||
LogDebug($"충전 차단 성공: 누적 {chargeAccumulatedDamage:F1} / 필요 {chargeRequiredDamage:F1}");
|
||||
CombatBalanceTracker.RecordBossEvent("집행 개시 차단 성공");
|
||||
return Status.Failure;
|
||||
return FinalizeResolvedPattern(BossPatternExecutionResult.Failed);
|
||||
}
|
||||
|
||||
if (Time.time < chargeEndTime)
|
||||
@@ -117,16 +131,21 @@ public abstract partial class BossPatternActionBase : Action
|
||||
|
||||
isWaiting = false;
|
||||
}
|
||||
else if (skillController.IsPlayingAnimation)
|
||||
else if (isSkillStepExecuting)
|
||||
{
|
||||
return Status.Running;
|
||||
if (skillController.IsPlayingAnimation)
|
||||
return Status.Running;
|
||||
|
||||
isSkillStepExecuting = false;
|
||||
if (skillController.LastExecutionResult != SkillExecutionResult.Completed)
|
||||
return FinalizePatternFailure(BossPatternExecutionResult.Cancelled);
|
||||
}
|
||||
|
||||
currentStepIndex++;
|
||||
if (currentStepIndex >= activePattern.Steps.Count)
|
||||
{
|
||||
UsePatternAction.MarkPatternUsed(GameObject, activePattern);
|
||||
return Status.Success;
|
||||
runtimeState.SetPatternCooldown(activePattern);
|
||||
return FinalizeResolvedPattern(BossPatternExecutionResult.Succeeded);
|
||||
}
|
||||
|
||||
return ExecuteCurrentStep();
|
||||
@@ -205,7 +224,7 @@ public abstract partial class BossPatternActionBase : Action
|
||||
|
||||
protected void LogDebug(string message)
|
||||
{
|
||||
combatBehaviorContext?.LogDebug(GetType().Name, message);
|
||||
runtimeState?.LogDebug(GetType().Name, message);
|
||||
}
|
||||
|
||||
private Status ExecuteCurrentStep()
|
||||
@@ -241,7 +260,7 @@ public abstract partial class BossPatternActionBase : Action
|
||||
{
|
||||
if (activePattern != null && activePattern.SkipJumpStepOnNoTarget)
|
||||
{
|
||||
UsePatternAction.MarkPatternUsed(GameObject, activePattern);
|
||||
runtimeState.SetPatternCooldown(activePattern);
|
||||
LogDebug($"점프 대상 없음, 조합 패턴 조기 종료: {activePattern.PatternName}");
|
||||
return Status.Success;
|
||||
}
|
||||
@@ -253,12 +272,13 @@ public abstract partial class BossPatternActionBase : Action
|
||||
enemyBase?.SetJumpTarget(skillTarget.transform.position);
|
||||
}
|
||||
|
||||
if (!skillController.ExecuteSkill(step.Skill))
|
||||
if (!skillController.ExecuteSkill(step.Skill, skillTarget))
|
||||
{
|
||||
Debug.LogWarning($"[{GetType().Name}] 스킬 실행 실패: {step.Skill.SkillName}");
|
||||
return Status.Failure;
|
||||
return FinalizePatternFailure(BossPatternExecutionResult.Failed);
|
||||
}
|
||||
|
||||
isSkillStepExecuting = true;
|
||||
LogDebug($"패턴 실행: {activePattern.PatternName} / Step={currentStepIndex} / Skill={step.Skill.SkillName}");
|
||||
return Status.Running;
|
||||
}
|
||||
@@ -308,7 +328,7 @@ public abstract partial class BossPatternActionBase : Action
|
||||
|
||||
if (broken && activeChargeData != null)
|
||||
{
|
||||
combatBehaviorContext.LastChargeStaggerDuration = activeChargeData.StaggerDuration;
|
||||
runtimeState.LastChargeStaggerDuration = activeChargeData.StaggerDuration;
|
||||
}
|
||||
|
||||
activeChargeData = null;
|
||||
@@ -327,7 +347,7 @@ public abstract partial class BossPatternActionBase : Action
|
||||
|
||||
private bool IsReady()
|
||||
{
|
||||
return bossEnemy != null && enemyBase != null && skillController != null && combatBehaviorContext != null;
|
||||
return bossEnemy != null && enemyBase != null && skillController != null && runtimeState != null;
|
||||
}
|
||||
|
||||
private void ResolveReferences()
|
||||
@@ -341,8 +361,8 @@ public abstract partial class BossPatternActionBase : Action
|
||||
if (skillController == null)
|
||||
skillController = GameObject.GetComponent<SkillController>();
|
||||
|
||||
if (combatBehaviorContext == null)
|
||||
combatBehaviorContext = GameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
if (runtimeState == null)
|
||||
runtimeState = GameObject.GetComponent<BossBehaviorRuntimeState>();
|
||||
|
||||
if (navMeshAgent == null)
|
||||
navMeshAgent = GameObject.GetComponent<UnityEngine.AI.NavMeshAgent>();
|
||||
@@ -360,6 +380,22 @@ public abstract partial class BossPatternActionBase : Action
|
||||
activeTarget = null;
|
||||
currentStepIndex = 0;
|
||||
isWaiting = false;
|
||||
isSkillStepExecuting = false;
|
||||
waitEndTime = 0f;
|
||||
}
|
||||
|
||||
private Status FinalizeResolvedPattern(BossPatternExecutionResult result)
|
||||
{
|
||||
runtimeState?.CompletePatternExecution(activePattern, result);
|
||||
if (result == BossPatternExecutionResult.Failed && ContinueSequenceOnResolvedFailure)
|
||||
return Status.Success;
|
||||
|
||||
return Status.Success;
|
||||
}
|
||||
|
||||
private Status FinalizePatternFailure(BossPatternExecutionResult result)
|
||||
{
|
||||
runtimeState?.CompletePatternExecution(activePattern, result);
|
||||
return Status.Failure;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ using Action = Unity.Behavior.Action;
|
||||
/// <summary>
|
||||
/// 보스를 경직시키는 BT 액션입니다.
|
||||
/// 충전 차단 성공 등의 상황에서 사용됩니다.
|
||||
/// 경직 시간은 BossCombatBehaviorContext.LastChargeStaggerDuration에서 읽습니다.
|
||||
/// 경직 시간은 BossBehaviorRuntimeState.LastChargeStaggerDuration에서 읽습니다.
|
||||
/// </summary>
|
||||
[Serializable, GeneratePropertyBag]
|
||||
[NodeDescription(
|
||||
@@ -21,21 +21,21 @@ using Action = Unity.Behavior.Action;
|
||||
id: "d4e5f6a7-1111-2222-3333-888899990000")]
|
||||
public partial class BossStaggerAction : Action
|
||||
{
|
||||
private BossCombatBehaviorContext combatBehaviorContext;
|
||||
private BossBehaviorRuntimeState runtimeState;
|
||||
private BossEnemy bossEnemy;
|
||||
private EnemyBase enemyBase;
|
||||
private float staggerEndTime;
|
||||
|
||||
protected override Status OnStart()
|
||||
{
|
||||
combatBehaviorContext = GameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
runtimeState = GameObject.GetComponent<BossBehaviorRuntimeState>();
|
||||
bossEnemy = GameObject.GetComponent<BossEnemy>();
|
||||
enemyBase = GameObject.GetComponent<EnemyBase>();
|
||||
|
||||
if (combatBehaviorContext == null || bossEnemy == null)
|
||||
if (runtimeState == null || bossEnemy == null)
|
||||
return Status.Failure;
|
||||
|
||||
float staggerDuration = combatBehaviorContext.LastChargeStaggerDuration;
|
||||
float staggerDuration = runtimeState.LastChargeStaggerDuration;
|
||||
if (staggerDuration <= 0f)
|
||||
return Status.Success;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public partial class ChaseTargetAction : Action
|
||||
|
||||
protected override Status OnStart()
|
||||
{
|
||||
BossCombatBehaviorContext context = GameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
BossBehaviorRuntimeState context = GameObject.GetComponent<BossBehaviorRuntimeState>();
|
||||
if (context != null && context.IsBehaviorSuppressed)
|
||||
{
|
||||
return Status.Failure;
|
||||
@@ -54,7 +54,7 @@ public partial class ChaseTargetAction : Action
|
||||
|
||||
protected override Status OnUpdate()
|
||||
{
|
||||
BossCombatBehaviorContext context = GameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
BossBehaviorRuntimeState context = GameObject.GetComponent<BossBehaviorRuntimeState>();
|
||||
if (context != null && context.IsBehaviorSuppressed)
|
||||
{
|
||||
if (agent != null)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
|
||||
using Colosseum;
|
||||
using Colosseum.Enemy;
|
||||
using Colosseum.Player;
|
||||
|
||||
using Unity.Behavior;
|
||||
using Unity.Properties;
|
||||
@@ -22,10 +24,13 @@ public partial class RefreshPrimaryTargetAction : Action
|
||||
[SerializeReference]
|
||||
public BlackboardVariable<GameObject> Target;
|
||||
|
||||
[SerializeReference]
|
||||
public BlackboardVariable<float> SearchRange = new BlackboardVariable<float>(0f);
|
||||
|
||||
protected override Status OnStart()
|
||||
{
|
||||
BossCombatBehaviorContext context = GameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
if (context != null && context.IsBehaviorSuppressed)
|
||||
BossBehaviorRuntimeState runtimeState = GameObject.GetComponent<BossBehaviorRuntimeState>();
|
||||
if (runtimeState != null && runtimeState.IsBehaviorSuppressed)
|
||||
return Status.Failure;
|
||||
|
||||
EnemyBase enemyBase = GameObject.GetComponent<EnemyBase>();
|
||||
@@ -33,17 +38,55 @@ public partial class RefreshPrimaryTargetAction : Action
|
||||
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);
|
||||
float searchRange = ResolveSearchRange(enemyBase);
|
||||
GameObject resolvedTarget = enemyBase.GetHighestThreatTarget(currentTarget, null, searchRange);
|
||||
|
||||
if (resolvedTarget == null)
|
||||
{
|
||||
resolvedTarget = context != null ? context.FindNearestLivingTarget() : null;
|
||||
}
|
||||
resolvedTarget = FindNearestLivingTarget(enemyBase, currentTarget, searchRange);
|
||||
|
||||
if (Target != null)
|
||||
Target.Value = resolvedTarget;
|
||||
|
||||
runtimeState?.SetCurrentTarget(resolvedTarget);
|
||||
runtimeState?.LogDebug(nameof(RefreshPrimaryTargetAction), resolvedTarget != null
|
||||
? $"주 대상 갱신: {resolvedTarget.name}"
|
||||
: "주 대상 갱신 실패");
|
||||
|
||||
return resolvedTarget != null ? Status.Success : Status.Failure;
|
||||
}
|
||||
|
||||
private float ResolveSearchRange(EnemyBase enemyBase)
|
||||
{
|
||||
if (SearchRange != null && SearchRange.Value > 0f)
|
||||
return SearchRange.Value;
|
||||
|
||||
return enemyBase != null && enemyBase.Data != null ? enemyBase.Data.AggroRange : Mathf.Infinity;
|
||||
}
|
||||
|
||||
private GameObject FindNearestLivingTarget(EnemyBase enemyBase, GameObject currentTarget, float searchRange)
|
||||
{
|
||||
PlayerNetworkController[] players = UnityEngine.Object.FindObjectsByType<PlayerNetworkController>(FindObjectsSortMode.None);
|
||||
GameObject nearestTarget = null;
|
||||
float nearestDistance = float.MaxValue;
|
||||
|
||||
for (int i = 0; i < players.Length; i++)
|
||||
{
|
||||
PlayerNetworkController player = players[i];
|
||||
if (player == null || player.IsDead || !player.gameObject.activeInHierarchy)
|
||||
continue;
|
||||
|
||||
GameObject candidate = player.gameObject;
|
||||
if (Team.IsSameTeam(GameObject, candidate))
|
||||
continue;
|
||||
|
||||
float distance = Vector3.Distance(GameObject.transform.position, candidate.transform.position);
|
||||
if (distance > searchRange || distance >= nearestDistance)
|
||||
continue;
|
||||
|
||||
nearestDistance = distance;
|
||||
nearestTarget = candidate;
|
||||
}
|
||||
|
||||
return nearestTarget != null ? nearestTarget : currentTarget;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,30 +34,32 @@ public partial class SelectAlternateTargetByDistanceAction : Action
|
||||
|
||||
protected override Status OnStart()
|
||||
{
|
||||
BossCombatBehaviorContext context = GameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
if (context == null)
|
||||
BossBehaviorRuntimeState runtimeState = GameObject.GetComponent<BossBehaviorRuntimeState>();
|
||||
if (runtimeState == null)
|
||||
return Status.Failure;
|
||||
|
||||
float minRange = MinRange.Value > 0f ? MinRange.Value : context.UtilityTriggerDistance;
|
||||
float minRange = Mathf.Max(0f, MinRange.Value);
|
||||
float maxRange = MaxRange.Value > 0f
|
||||
? MaxRange.Value
|
||||
: (context.EnemyBase != null && context.EnemyBase.Data != null ? context.EnemyBase.Data.AggroRange : 20f);
|
||||
: (runtimeState.EnemyBase != null && runtimeState.EnemyBase.Data != null ? runtimeState.EnemyBase.Data.AggroRange : 20f);
|
||||
|
||||
GameObject selectedTarget = SelectTarget(context, minRange, maxRange);
|
||||
GameObject selectedTarget = SelectTarget(runtimeState, minRange, maxRange);
|
||||
if (selectedTarget == null)
|
||||
return Status.Failure;
|
||||
|
||||
Target.Value = selectedTarget;
|
||||
runtimeState.SetCurrentTarget(selectedTarget);
|
||||
runtimeState.LogDebug(nameof(SelectAlternateTargetByDistanceAction), $"보조 대상 선택: {selectedTarget.name}");
|
||||
return Status.Success;
|
||||
}
|
||||
|
||||
private GameObject SelectTarget(BossCombatBehaviorContext context, float minRange, float maxRange)
|
||||
private GameObject SelectTarget(BossBehaviorRuntimeState runtimeState, float minRange, float maxRange)
|
||||
{
|
||||
PlayerNetworkController[] players = UnityEngine.Object.FindObjectsByType<PlayerNetworkController>(FindObjectsSortMode.None);
|
||||
if (players == null || players.Length == 0)
|
||||
return null;
|
||||
|
||||
GameObject primaryTarget = context.ResolvePrimaryTarget();
|
||||
GameObject primaryTarget = ResolvePrimaryTarget(runtimeState);
|
||||
List<GameObject> validTargets = new List<GameObject>();
|
||||
|
||||
for (int i = 0; i < players.Length; i++)
|
||||
@@ -70,7 +72,7 @@ public partial class SelectAlternateTargetByDistanceAction : Action
|
||||
if (candidate == primaryTarget)
|
||||
continue;
|
||||
|
||||
if (!context.IsValidHostileTarget(candidate))
|
||||
if (!IsValidHostileTarget(candidate))
|
||||
continue;
|
||||
|
||||
float distance = Vector3.Distance(GameObject.transform.position, candidate.transform.position);
|
||||
@@ -82,7 +84,7 @@ public partial class SelectAlternateTargetByDistanceAction : Action
|
||||
|
||||
if (validTargets.Count == 0)
|
||||
{
|
||||
if (primaryTarget != null && context.IsValidHostileTarget(primaryTarget))
|
||||
if (primaryTarget != null && IsValidHostileTarget(primaryTarget))
|
||||
{
|
||||
float primaryDistance = Vector3.Distance(GameObject.transform.position, primaryTarget.transform.position);
|
||||
if (primaryDistance >= minRange && primaryDistance <= maxRange)
|
||||
@@ -95,4 +97,52 @@ public partial class SelectAlternateTargetByDistanceAction : Action
|
||||
int randomIndex = UnityEngine.Random.Range(0, validTargets.Count);
|
||||
return validTargets[randomIndex];
|
||||
}
|
||||
|
||||
private GameObject ResolvePrimaryTarget(BossBehaviorRuntimeState runtimeState)
|
||||
{
|
||||
EnemyBase enemyBase = runtimeState.EnemyBase;
|
||||
GameObject currentTarget = runtimeState.CurrentTarget;
|
||||
float aggroRange = enemyBase != null && enemyBase.Data != null ? enemyBase.Data.AggroRange : Mathf.Infinity;
|
||||
GameObject highestThreatTarget = enemyBase != null
|
||||
? enemyBase.GetHighestThreatTarget(currentTarget, null, aggroRange)
|
||||
: null;
|
||||
|
||||
if (highestThreatTarget != null)
|
||||
return highestThreatTarget;
|
||||
|
||||
PlayerNetworkController[] players = UnityEngine.Object.FindObjectsByType<PlayerNetworkController>(FindObjectsSortMode.None);
|
||||
GameObject nearestTarget = null;
|
||||
float nearestDistance = float.MaxValue;
|
||||
for (int i = 0; i < players.Length; i++)
|
||||
{
|
||||
PlayerNetworkController player = players[i];
|
||||
if (player == null || player.IsDead || !player.gameObject.activeInHierarchy)
|
||||
continue;
|
||||
|
||||
GameObject candidate = player.gameObject;
|
||||
if (!IsValidHostileTarget(candidate))
|
||||
continue;
|
||||
|
||||
float distance = Vector3.Distance(GameObject.transform.position, candidate.transform.position);
|
||||
if (distance > aggroRange || distance >= nearestDistance)
|
||||
continue;
|
||||
|
||||
nearestDistance = distance;
|
||||
nearestTarget = candidate;
|
||||
}
|
||||
|
||||
return nearestTarget;
|
||||
}
|
||||
|
||||
private bool IsValidHostileTarget(GameObject candidate)
|
||||
{
|
||||
if (candidate == null || !candidate.activeInHierarchy)
|
||||
return false;
|
||||
|
||||
if (Team.IsSameTeam(GameObject, candidate))
|
||||
return false;
|
||||
|
||||
IDamageable damageable = candidate.GetComponent<IDamageable>();
|
||||
return damageable == null || !damageable.IsDead;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,29 +65,19 @@ public partial class SelectNearestDownedTargetAction : Action
|
||||
return Status.Failure;
|
||||
|
||||
Target.Value = nearestTarget;
|
||||
GameObject.GetComponent<BossBehaviorRuntimeState>()?.SetCurrentTarget(nearestTarget);
|
||||
LogDebug($"다운 대상 선택: {nearestTarget.name}");
|
||||
return Status.Success;
|
||||
}
|
||||
|
||||
private float ResolveSearchRadius()
|
||||
{
|
||||
if (SearchRadius.Value > 0f)
|
||||
return SearchRadius.Value;
|
||||
|
||||
BossCombatBehaviorContext context = GameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
if (context != null)
|
||||
return context.PunishSearchRadius;
|
||||
|
||||
EnemyBase enemyBase = GameObject.GetComponent<EnemyBase>();
|
||||
if (enemyBase != null && enemyBase.Data != null)
|
||||
return enemyBase.Data.AttackRange + 4f;
|
||||
|
||||
return 6f;
|
||||
return Mathf.Max(0f, SearchRadius.Value);
|
||||
}
|
||||
|
||||
private void LogDebug(string message)
|
||||
{
|
||||
BossCombatBehaviorContext context = GameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
BossBehaviorRuntimeState context = GameObject.GetComponent<BossBehaviorRuntimeState>();
|
||||
context?.LogDebug(nameof(SelectNearestDownedTargetAction), message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,10 +57,7 @@ public partial class SelectTargetByDistanceAction : Action
|
||||
|
||||
float minRange = Mathf.Max(0f, MinRange.Value);
|
||||
float maxRange = Mathf.Max(minRange, MaxRange.Value);
|
||||
BossCombatBehaviorContext context = GameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
|
||||
if (minRange <= 0f && context != null)
|
||||
minRange = context.MobilityTriggerDistance;
|
||||
BossBehaviorRuntimeState runtimeState = GameObject.GetComponent<BossBehaviorRuntimeState>();
|
||||
|
||||
if (maxRange <= minRange)
|
||||
{
|
||||
@@ -79,6 +76,8 @@ public partial class SelectTargetByDistanceAction : Action
|
||||
return Status.Failure;
|
||||
|
||||
Target.Value = selectedTarget;
|
||||
runtimeState?.SetCurrentTarget(selectedTarget);
|
||||
runtimeState?.LogDebug(nameof(SelectTargetByDistanceAction), $"거리 기반 대상 선택: {selectedTarget.name} / Mode={SelectionMode.Value}");
|
||||
return Status.Success;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
|
||||
using Colosseum.Enemy;
|
||||
|
||||
using Unity.Behavior;
|
||||
using Unity.Properties;
|
||||
using UnityEngine;
|
||||
|
||||
using Action = Unity.Behavior.Action;
|
||||
|
||||
/// <summary>
|
||||
/// BT가 보스의 현재 페이즈 값을 직접 설정합니다.
|
||||
/// </summary>
|
||||
[Serializable, GeneratePropertyBag]
|
||||
[NodeDescription(
|
||||
name: "Set Boss Phase",
|
||||
story: "[TargetPhase] 페이즈로 설정",
|
||||
category: "Action",
|
||||
id: "931c24f8-761f-4d07-a7a0-23c7a7678d6b")]
|
||||
public partial class SetBossPhaseAction : Action
|
||||
{
|
||||
[SerializeReference]
|
||||
[Tooltip("설정할 목표 페이즈 (1부터 시작)")]
|
||||
public BlackboardVariable<int> TargetPhase = new BlackboardVariable<int>(1);
|
||||
|
||||
[SerializeReference]
|
||||
[Tooltip("true면 페이즈 경과 시간도 함께 초기화합니다.")]
|
||||
public BlackboardVariable<bool> ResetTimer = new BlackboardVariable<bool>(true);
|
||||
|
||||
protected override Status OnStart()
|
||||
{
|
||||
BossBehaviorRuntimeState context = GameObject.GetComponent<BossBehaviorRuntimeState>();
|
||||
if (context == null)
|
||||
return Status.Failure;
|
||||
|
||||
context.SetCurrentPatternPhase(TargetPhase?.Value ?? 1, ResetTimer?.Value ?? true);
|
||||
context.LogDebug(nameof(SetBossPhaseAction), $"현재 페이즈 설정: {context.CurrentPatternPhase}");
|
||||
return Status.Success;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7d6f3b56c0073c6fda51d5837ffc49a7
|
||||
@@ -14,7 +14,7 @@ using Action = Unity.Behavior.Action;
|
||||
|
||||
/// <summary>
|
||||
/// 충전 차단에 실패하여 패턴이 완료되었을 때, 전체 플레이어에게 범위 효과를 적용합니다.
|
||||
/// 기존 BossCombatBehaviorContext.ExecuteSignatureFailure()의 BT 노드 이관 버전입니다.
|
||||
/// 런타임 상태에 저장된 시그니처 실패 수치를 읽어 범위 효과를 적용하는 BT 노드입니다.
|
||||
/// </summary>
|
||||
[Serializable, GeneratePropertyBag]
|
||||
[NodeDescription(
|
||||
@@ -24,14 +24,14 @@ using Action = Unity.Behavior.Action;
|
||||
id: "c3d4e5f6-1111-2222-3333-777788889999")]
|
||||
public partial class SignatureFailureEffectsAction : Action
|
||||
{
|
||||
private BossCombatBehaviorContext combatBehaviorContext;
|
||||
private BossBehaviorRuntimeState runtimeState;
|
||||
|
||||
protected override Status OnStart()
|
||||
{
|
||||
combatBehaviorContext = GameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
if (combatBehaviorContext == null)
|
||||
runtimeState = GameObject.GetComponent<BossBehaviorRuntimeState>();
|
||||
if (runtimeState == null)
|
||||
{
|
||||
Debug.LogWarning("[SignatureFailureEffects] BossCombatBehaviorContext를 찾을 수 없습니다.");
|
||||
Debug.LogWarning("[SignatureFailureEffects] BossBehaviorRuntimeState를 찾을 수 없습니다.");
|
||||
return Status.Failure;
|
||||
}
|
||||
|
||||
@@ -41,13 +41,13 @@ public partial class SignatureFailureEffectsAction : Action
|
||||
|
||||
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;
|
||||
float failureDamage = runtimeState.SignatureFailureDamage;
|
||||
AbnormalityData failureAbnormality = runtimeState.SignatureFailureAbnormality;
|
||||
float knockbackRadius = runtimeState.SignatureFailureKnockbackRadius;
|
||||
float downRadius = runtimeState.SignatureFailureDownRadius;
|
||||
float knockbackSpeed = runtimeState.SignatureFailureKnockbackSpeed;
|
||||
float knockbackDuration = runtimeState.SignatureFailureKnockbackDuration;
|
||||
float downDuration = runtimeState.SignatureFailureDownDuration;
|
||||
|
||||
PlayerNetworkController[] players = UnityEngine.Object.FindObjectsByType<PlayerNetworkController>(FindObjectsSortMode.None);
|
||||
for (int i = 0; i < players.Length; i++)
|
||||
@@ -57,9 +57,6 @@ public partial class SignatureFailureEffectsAction : Action
|
||||
continue;
|
||||
|
||||
GameObject target = player.gameObject;
|
||||
if (!combatBehaviorContext.IsValidHostileTarget(target))
|
||||
continue;
|
||||
|
||||
player.TakeDamage(failureDamage, GameObject);
|
||||
|
||||
if (failureAbnormality != null)
|
||||
|
||||
@@ -30,6 +30,7 @@ public partial class UsePatternAction : Action
|
||||
private int currentStepIndex;
|
||||
private float waitEndTime;
|
||||
private bool isWaiting;
|
||||
private bool isSkillStepExecuting;
|
||||
|
||||
protected override Status OnStart()
|
||||
{
|
||||
@@ -66,6 +67,7 @@ public partial class UsePatternAction : Action
|
||||
|
||||
currentStepIndex = 0;
|
||||
isWaiting = false;
|
||||
isSkillStepExecuting = false;
|
||||
return ExecuteCurrentStep();
|
||||
}
|
||||
|
||||
@@ -83,9 +85,17 @@ public partial class UsePatternAction : Action
|
||||
}
|
||||
else
|
||||
{
|
||||
if (skillController.IsPlayingAnimation)
|
||||
return Status.Running;
|
||||
if (isSkillStepExecuting)
|
||||
{
|
||||
if (skillController.IsPlayingAnimation)
|
||||
return Status.Running;
|
||||
|
||||
isSkillStepExecuting = false;
|
||||
if (skillController.LastExecutionResult != SkillExecutionResult.Completed)
|
||||
return Status.Failure;
|
||||
}
|
||||
else if (skillController.IsPlayingAnimation)
|
||||
return Status.Running;
|
||||
}
|
||||
|
||||
currentStepIndex++;
|
||||
@@ -102,6 +112,7 @@ public partial class UsePatternAction : Action
|
||||
protected override void OnEnd()
|
||||
{
|
||||
skillController = null;
|
||||
isSkillStepExecuting = false;
|
||||
}
|
||||
|
||||
private Status ExecuteCurrentStep()
|
||||
@@ -132,13 +143,17 @@ public partial class UsePatternAction : Action
|
||||
}
|
||||
}
|
||||
|
||||
bool success = skillController.ExecuteSkill(step.Skill);
|
||||
GameObject skillTarget = step.Skill.JumpToTarget ? jumpTarget : Target?.Value;
|
||||
bool success = skillTarget != null
|
||||
? skillController.ExecuteSkill(step.Skill, skillTarget)
|
||||
: skillController.ExecuteSkill(step.Skill);
|
||||
if (!success)
|
||||
{
|
||||
Debug.LogWarning($"[UsePatternAction] 스킬 실행 실패: {step.Skill.SkillName} (index {currentStepIndex})");
|
||||
return Status.Failure;
|
||||
}
|
||||
|
||||
isSkillStepExecuting = true;
|
||||
LogDebug($"패턴 실행: {Pattern.Value.PatternName} / Step={currentStepIndex} / Skill={step.Skill.SkillName}");
|
||||
|
||||
// jumpToTarget 스킬이면 타겟 위치 전달
|
||||
@@ -233,7 +248,7 @@ public partial class UsePatternAction : Action
|
||||
|
||||
private void LogDebug(string message)
|
||||
{
|
||||
BossCombatBehaviorContext context = GameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
BossBehaviorRuntimeState context = GameObject.GetComponent<BossBehaviorRuntimeState>();
|
||||
context?.LogDebug(nameof(UsePatternAction), message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,15 @@ public partial class UsePatternByRoleAction : BossPatternActionBase
|
||||
[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;
|
||||
@@ -36,7 +45,7 @@ public partial class UsePatternByRoleAction : BossPatternActionBase
|
||||
// 여기서는 RegisterPatternUse만 호출 (근접 패턴 전용)
|
||||
if (pattern.IsMelee)
|
||||
{
|
||||
BossCombatBehaviorContext context = GameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
BossBehaviorRuntimeState context = GameObject.GetComponent<BossBehaviorRuntimeState>();
|
||||
context?.RegisterPatternUse(pattern);
|
||||
}
|
||||
|
||||
@@ -66,7 +75,8 @@ public partial class UsePatternByRoleAction : BossPatternActionBase
|
||||
if (pattern == null)
|
||||
return false;
|
||||
|
||||
if (!UsePatternAction.IsPatternReady(GameObject, pattern))
|
||||
BossBehaviorRuntimeState context = GameObject.GetComponent<BossBehaviorRuntimeState>();
|
||||
if (context == null || !context.IsPatternReady(pattern))
|
||||
return false;
|
||||
|
||||
if (target == null)
|
||||
@@ -77,26 +87,6 @@ public partial class UsePatternByRoleAction : BossPatternActionBase
|
||||
|
||||
protected override GameObject ResolveStepTarget(GameObject fallbackTarget)
|
||||
{
|
||||
BossPatternData pattern = Pattern?.Value;
|
||||
if (pattern == null)
|
||||
return base.ResolveStepTarget(fallbackTarget);
|
||||
|
||||
BossCombatBehaviorContext context = GameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
if (context == null)
|
||||
return base.ResolveStepTarget(fallbackTarget);
|
||||
|
||||
TargetResolveMode targetMode = pattern.TargetMode;
|
||||
|
||||
if (targetMode == TargetResolveMode.Mobility)
|
||||
return context.IsValidMobilityTarget(fallbackTarget)
|
||||
? fallbackTarget
|
||||
: context.FindMobilityTarget();
|
||||
|
||||
if (targetMode == TargetResolveMode.Utility)
|
||||
return context.IsValidUtilityTarget(fallbackTarget)
|
||||
? fallbackTarget
|
||||
: context.FindUtilityTarget();
|
||||
|
||||
return base.ResolveStepTarget(fallbackTarget);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,9 @@ public partial class UseSkillAction : Action
|
||||
}
|
||||
|
||||
// 스킬 실행 시도
|
||||
bool success = skillController.ExecuteSkill(스킬.Value);
|
||||
bool success = Target?.Value != null
|
||||
? skillController.ExecuteSkill(스킬.Value, Target.Value)
|
||||
: skillController.ExecuteSkill(스킬.Value);
|
||||
if (!success)
|
||||
{
|
||||
// 이미 다른 스킬 사용 중이거나 쿨타임
|
||||
@@ -63,9 +65,7 @@ public partial class UseSkillAction : Action
|
||||
|
||||
// 스킬 애니메이션이 종료되면 성공
|
||||
if (!skillController.IsPlayingAnimation)
|
||||
{
|
||||
return Status.Success;
|
||||
}
|
||||
return skillController.LastExecutionResult == SkillExecutionResult.Completed ? Status.Success : Status.Failure;
|
||||
|
||||
return Status.Running;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
|
||||
using Colosseum.Enemy;
|
||||
|
||||
using Unity.Behavior;
|
||||
using Unity.Properties;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Colosseum.AI.BehaviorActions.Conditions
|
||||
{
|
||||
/// <summary>
|
||||
/// 마지막 대형 패턴 이후 누적된 기본 루프 횟수가 기준 이상인지 확인합니다.
|
||||
/// </summary>
|
||||
[Serializable, GeneratePropertyBag]
|
||||
[Condition(name: "Is Basic Loop Count At Least", story: "기본 루프 누적 횟수가 [Count]회 이상인가?", id: "5c54d42c-780b-4334-bf58-1f7d4c79f4ea")]
|
||||
[NodeDescription(
|
||||
name: "Is Basic Loop Count At Least",
|
||||
story: "기본 루프 누적 횟수가 [Count]회 이상인가?",
|
||||
category: "Condition/Pattern")]
|
||||
public partial class IsBasicLoopCountAtLeastCondition : Unity.Behavior.Condition
|
||||
{
|
||||
[SerializeReference]
|
||||
[Tooltip("필요한 최소 기본 루프 횟수")]
|
||||
public BlackboardVariable<int> Count = new BlackboardVariable<int>(0);
|
||||
|
||||
public override bool IsTrue()
|
||||
{
|
||||
BossBehaviorRuntimeState runtimeState = GameObject.GetComponent<BossBehaviorRuntimeState>();
|
||||
return runtimeState != null && runtimeState.BasicLoopCountSinceLastBigPattern >= Mathf.Max(0, Count?.Value ?? 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6aa918a0d90f67399b6cfb594edc31b
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
|
||||
using Colosseum.Enemy;
|
||||
|
||||
using Unity.Behavior;
|
||||
using Unity.Properties;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Colosseum.AI.BehaviorActions.Conditions
|
||||
{
|
||||
/// <summary>
|
||||
/// 보스가 보유한 커스텀 조건 플래그가 활성화되었는지 확인합니다.
|
||||
/// </summary>
|
||||
[Serializable, GeneratePropertyBag]
|
||||
[Condition(name: "Is Boss Custom Condition True", story: "커스텀 조건 [ConditionId] 가 참인가?", id: "0c4a5f77-a599-40a7-80fb-d22c4bb27f19")]
|
||||
[NodeDescription(
|
||||
name: "Is Boss Custom Condition True",
|
||||
story: "커스텀 조건 [ConditionId] 가 참인가?",
|
||||
category: "Condition/Phase")]
|
||||
public partial class IsBossCustomConditionTrueCondition : Unity.Behavior.Condition
|
||||
{
|
||||
[SerializeReference]
|
||||
[Tooltip("확인할 커스텀 조건 ID")]
|
||||
public BlackboardVariable<string> ConditionId = new BlackboardVariable<string>(string.Empty);
|
||||
|
||||
public override bool IsTrue()
|
||||
{
|
||||
BossBehaviorRuntimeState context = GameObject.GetComponent<BossBehaviorRuntimeState>();
|
||||
return context != null && !string.IsNullOrEmpty(ConditionId?.Value) && context.CheckPhaseCustomCondition(ConditionId.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 125ba0ac5df532b00b25e8bfc3f556e3
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
|
||||
using Colosseum.Enemy;
|
||||
|
||||
using Unity.Behavior;
|
||||
using Unity.Properties;
|
||||
using UnityEngine;
|
||||
|
||||
using Condition = Unity.Behavior.Condition;
|
||||
|
||||
namespace Colosseum.AI.BehaviorActions.Conditions
|
||||
{
|
||||
[Serializable, GeneratePropertyBag]
|
||||
[Condition(name: "Is Charge Broken", story: "충전이 차단되었는가?", id: "e5f6a7b8-1111-2222-3333-aaaaaaaa0001")]
|
||||
[NodeDescription(
|
||||
name: "Is Charge Broken",
|
||||
story: "Charge was broken by accumulated damage",
|
||||
category: "Condition/Pattern")]
|
||||
public partial class IsChargeBrokenCondition : Condition
|
||||
{
|
||||
public override bool IsTrue()
|
||||
{
|
||||
BossBehaviorRuntimeState context = GameObject.GetComponent<BossBehaviorRuntimeState>();
|
||||
return context != null && context.WasChargeBroken;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe107cb64ea2a7c07adc2fc4db48a4d1
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
|
||||
using Colosseum.Enemy;
|
||||
|
||||
using Unity.Behavior;
|
||||
using Unity.Properties;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Colosseum.AI.BehaviorActions.Conditions
|
||||
{
|
||||
/// <summary>
|
||||
/// 현재 보스 페이즈가 지정한 값과 같은지 확인합니다.
|
||||
/// </summary>
|
||||
[Serializable, GeneratePropertyBag]
|
||||
[Condition(name: "Is Current Phase", story: "현재 페이즈가 [Phase] 인가?", id: "6dc82e39-6f84-43df-b8ce-5b7c0ac8e390")]
|
||||
[NodeDescription(
|
||||
name: "Is Current Phase",
|
||||
story: "현재 페이즈가 [Phase] 인가?",
|
||||
category: "Condition/Phase")]
|
||||
public partial class IsCurrentPhaseCondition : Unity.Behavior.Condition
|
||||
{
|
||||
[SerializeReference]
|
||||
[Tooltip("확인할 현재 페이즈 값 (1부터 시작)")]
|
||||
public BlackboardVariable<int> Phase = new BlackboardVariable<int>(1);
|
||||
|
||||
public override bool IsTrue()
|
||||
{
|
||||
BossBehaviorRuntimeState context = GameObject.GetComponent<BossBehaviorRuntimeState>();
|
||||
return context != null && context.CurrentPatternPhase == Mathf.Max(1, Phase?.Value ?? 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c664951a5687590b593a30936378b8d2
|
||||
@@ -23,13 +23,13 @@ namespace Colosseum.AI.BehaviorActions.Conditions
|
||||
category: "Condition/Pattern")]
|
||||
public partial class IsDownedTargetInRangeCondition : Condition
|
||||
{
|
||||
[Min(0f)]
|
||||
[SerializeReference]
|
||||
[Tooltip("다운된 대상을 탐색할 최대 반경")]
|
||||
[SerializeField]
|
||||
private float searchRadius = 6f;
|
||||
public BlackboardVariable<float> SearchRadius = new BlackboardVariable<float>(6f);
|
||||
|
||||
public override bool IsTrue()
|
||||
{
|
||||
float searchRadius = Mathf.Max(0f, SearchRadius.Value);
|
||||
HitReactionController[] controllers = UnityEngine.Object.FindObjectsByType<HitReactionController>(FindObjectsSortMode.None);
|
||||
|
||||
for (int i = 0; i < controllers.Length; i++)
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Colosseum.AI.BehaviorActions.Conditions
|
||||
if (minPhase <= 1)
|
||||
return true;
|
||||
|
||||
BossCombatBehaviorContext context = GameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
BossBehaviorRuntimeState context = GameObject.GetComponent<BossBehaviorRuntimeState>();
|
||||
return context != null && context.CurrentPatternPhase >= minPhase;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
|
||||
using Colosseum.Enemy;
|
||||
|
||||
using Unity.Behavior;
|
||||
using Unity.Properties;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Colosseum.AI.BehaviorActions.Conditions
|
||||
{
|
||||
/// <summary>
|
||||
/// 마지막 패턴 실행 결과가 지정한 값과 일치하는지 확인합니다.
|
||||
/// </summary>
|
||||
[Serializable, GeneratePropertyBag]
|
||||
[Condition(name: "Is Pattern Execution Result", story: "마지막 패턴 결과가 [Result] 인가?", id: "4ffbf07b-3fa4-42cc-9a61-75fd07b05db6")]
|
||||
[NodeDescription(
|
||||
name: "Is Pattern Execution Result",
|
||||
story: "마지막 패턴 결과가 [Result] 인가?",
|
||||
category: "Condition/Pattern")]
|
||||
public partial class IsPatternExecutionResultCondition : Unity.Behavior.Condition
|
||||
{
|
||||
[SerializeReference]
|
||||
public BlackboardVariable<BossPatternExecutionResult> Result = new BlackboardVariable<BossPatternExecutionResult>(BossPatternExecutionResult.Succeeded);
|
||||
|
||||
public override bool IsTrue()
|
||||
{
|
||||
BossBehaviorRuntimeState runtimeState = GameObject.GetComponent<BossBehaviorRuntimeState>();
|
||||
return runtimeState != null && runtimeState.LastPatternExecutionResult == (Result?.Value ?? BossPatternExecutionResult.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 47a54f9591003b10db94afd51bf8cb54
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
|
||||
using Colosseum.Enemy;
|
||||
|
||||
using Unity.Behavior;
|
||||
using Unity.Properties;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Colosseum.AI.BehaviorActions.Conditions
|
||||
{
|
||||
/// <summary>
|
||||
/// 현재 페이즈의 경과 시간이 기준 이상인지 확인합니다.
|
||||
/// </summary>
|
||||
[Serializable, GeneratePropertyBag]
|
||||
[Condition(name: "Is Phase Elapsed Time Above", story: "페이즈 경과 시간이 [Seconds]초 이상인가?", id: "f0e0f5b3-3cb7-4991-ae8a-e89efcc0dbca")]
|
||||
[NodeDescription(
|
||||
name: "Is Phase Elapsed Time Above",
|
||||
story: "페이즈 경과 시간이 [Seconds]초 이상인가?",
|
||||
category: "Condition/Phase")]
|
||||
public partial class IsPhaseElapsedTimeAboveCondition : Unity.Behavior.Condition
|
||||
{
|
||||
[SerializeReference]
|
||||
[Tooltip("확인할 최소 경과 시간(초)")]
|
||||
public BlackboardVariable<float> Seconds = new BlackboardVariable<float>(0f);
|
||||
|
||||
public override bool IsTrue()
|
||||
{
|
||||
BossBehaviorRuntimeState context = GameObject.GetComponent<BossBehaviorRuntimeState>();
|
||||
return context != null && context.PhaseElapsedTime >= Mathf.Max(0f, Seconds?.Value ?? 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dceca864920c7cd5f8fdcf971355f380
|
||||
@@ -23,13 +23,13 @@ namespace Colosseum.AI.BehaviorActions.Conditions
|
||||
category: "Condition/Pattern")]
|
||||
public partial class IsTargetBeyondDistanceCondition : Condition
|
||||
{
|
||||
[Min(0f)]
|
||||
[SerializeReference]
|
||||
[Tooltip("이 거리 이상 떨어진 대상이 있는지 확인")]
|
||||
[SerializeField]
|
||||
private float minDistance = 8f;
|
||||
public BlackboardVariable<float> MinDistance = new BlackboardVariable<float>(8f);
|
||||
|
||||
public override bool IsTrue()
|
||||
{
|
||||
float minDistance = Mathf.Max(0f, MinDistance.Value);
|
||||
IDamageable[] targets = UnityEngine.Object.FindObjectsByType<MonoBehaviour>(FindObjectsSortMode.None)
|
||||
.OfType<IDamageable>()
|
||||
.ToArray();
|
||||
|
||||
@@ -17,20 +17,22 @@ namespace Colosseum.AI.BehaviorActions.Conditions
|
||||
[Condition(name: "Is Target In Attack Range", story: "타겟이 공격 사거리 안에 있는가?", id: "57370b5b23f82a54dabc4f189a23286a")]
|
||||
[NodeDescription(
|
||||
name: "Is Target In Attack Range",
|
||||
story: "Is [Target] in attack range",
|
||||
story: "Is [Target] in [AttackRange]m attack range",
|
||||
category: "Condition/Combat")]
|
||||
public partial class IsTargetInAttackRangeCondition : Condition
|
||||
{
|
||||
[SerializeReference]
|
||||
public BlackboardVariable<GameObject> Target;
|
||||
|
||||
[SerializeReference]
|
||||
public BlackboardVariable<float> AttackRange = new BlackboardVariable<float>(2f);
|
||||
|
||||
public override bool IsTrue()
|
||||
{
|
||||
if (Target?.Value == null)
|
||||
return false;
|
||||
|
||||
EnemyBase enemyBase = GameObject.GetComponent<EnemyBase>();
|
||||
float attackRange = enemyBase != null && enemyBase.Data != null ? enemyBase.Data.AttackRange : 2f;
|
||||
float attackRange = Mathf.Max(0f, AttackRange.Value);
|
||||
float distance = Vector3.Distance(GameObject.transform.position, Target.Value.transform.position);
|
||||
return distance <= attackRange + 0.25f;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Colosseum.AI.BehaviorActions.Conditions
|
||||
if (pattern == null)
|
||||
return false;
|
||||
|
||||
BossCombatBehaviorContext context = gameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
BossBehaviorRuntimeState context = gameObject.GetComponent<BossBehaviorRuntimeState>();
|
||||
if (context == null)
|
||||
return false;
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Colosseum.AI.BehaviorActions.Conditions
|
||||
if (!context.IsPatternGracePeriodAllowed(pattern))
|
||||
return false;
|
||||
|
||||
return UsePatternAction.IsPatternReady(gameObject, pattern);
|
||||
return context.IsPatternReady(pattern);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,16 +13,19 @@ namespace Colosseum.Editor
|
||||
public class BossEnemyEditor : UnityEditor.Editor
|
||||
{
|
||||
private BossEnemy boss;
|
||||
private BossBehaviorRuntimeState bossContext;
|
||||
private bool showPhaseDetails = true;
|
||||
private bool showThreatInfo = true;
|
||||
private bool showDebugTools = true;
|
||||
private int selectedPhaseIndex = 0;
|
||||
private float debugHPPercent = 1f;
|
||||
private float debugHPValue = 0f;
|
||||
private string customConditionId = "Enraged";
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
boss = (BossEnemy)target;
|
||||
bossContext = boss != null ? boss.GetComponent<BossBehaviorRuntimeState>() : null;
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
@@ -70,14 +73,11 @@ namespace Colosseum.Editor
|
||||
DrawProgressBar("HP", hpPercent, GetHealthColor(hpPercent), $"{boss.CurrentHealth:F0} / {boss.MaxHealth:F0}");
|
||||
|
||||
// 상태 정보
|
||||
EditorGUILayout.LabelField("현재 페이즈", $"{boss.CurrentPhaseIndex + 1} / {boss.TotalPhases}");
|
||||
EditorGUILayout.LabelField("현재 페이즈", bossContext != null
|
||||
? $"{bossContext.CurrentPatternPhase} / {bossContext.MaxPatternPhase}"
|
||||
: "N/A");
|
||||
EditorGUILayout.LabelField("상태", GetStatusText());
|
||||
|
||||
if (boss.CurrentPhase != null)
|
||||
{
|
||||
EditorGUILayout.LabelField("페이즈명", boss.CurrentPhase.PhaseName);
|
||||
}
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
@@ -93,53 +93,16 @@ namespace Colosseum.Editor
|
||||
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
var phasesProp = serializedObject.FindProperty("phases");
|
||||
if (phasesProp == null || phasesProp.arraySize == 0)
|
||||
if (bossContext == null)
|
||||
{
|
||||
EditorGUILayout.HelpBox("등록된 페이즈가 없습니다.", MessageType.Warning);
|
||||
EditorGUILayout.HelpBox("BossBehaviorRuntimeState를 찾지 못했습니다.", MessageType.Warning);
|
||||
EditorGUI.indentLevel--;
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < phasesProp.arraySize; i++)
|
||||
{
|
||||
var phaseProp = phasesProp.GetArrayElementAtIndex(i);
|
||||
var phase = phaseProp.objectReferenceValue as BossPhaseData;
|
||||
|
||||
if (phase == null)
|
||||
continue;
|
||||
|
||||
bool isCurrentPhase = i == boss.CurrentPhaseIndex;
|
||||
bool isCompleted = i < boss.CurrentPhaseIndex;
|
||||
|
||||
// 페이즈 헤더
|
||||
GUIStyle phaseStyle = new GUIStyle(EditorStyles.foldout);
|
||||
if (isCurrentPhase)
|
||||
phaseStyle.fontStyle = FontStyle.Bold;
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
// 상태 아이콘
|
||||
string statusIcon = isCurrentPhase ? "▶" : (isCompleted ? "✓" : "○");
|
||||
GUIContent phaseLabel = new GUIContent($"{statusIcon} Phase {i + 1}: {phase.PhaseName}");
|
||||
|
||||
EditorGUILayout.LabelField(phaseLabel, GUILayout.Width(200));
|
||||
|
||||
// 전환 조건
|
||||
EditorGUILayout.LabelField($"[{phase.TransitionType}]", EditorStyles.miniLabel, GUILayout.Width(100));
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
if (isCurrentPhase)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.LabelField($"전환 조건: {GetTransitionConditionText(phase)}");
|
||||
EditorGUILayout.LabelField($"경과 시간: {boss.PhaseElapsedTime:F1}초");
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
EditorGUILayout.Space(2);
|
||||
}
|
||||
EditorGUILayout.LabelField("현재 Phase", bossContext.CurrentPatternPhase.ToString());
|
||||
EditorGUILayout.LabelField("최대 Phase", bossContext.MaxPatternPhase.ToString());
|
||||
EditorGUILayout.LabelField("경과 시간", $"{bossContext.PhaseElapsedTime:F1}초");
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
@@ -191,12 +154,13 @@ namespace Colosseum.Editor
|
||||
// 페이즈 강제 전환
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField("페이즈 강제 전환", GUILayout.Width(120));
|
||||
selectedPhaseIndex = EditorGUILayout.IntSlider(selectedPhaseIndex, 0, Mathf.Max(0, boss.TotalPhases - 1));
|
||||
int maxPhaseIndex = bossContext != null ? Mathf.Max(0, bossContext.MaxPatternPhase - 1) : 0;
|
||||
selectedPhaseIndex = EditorGUILayout.IntSlider(selectedPhaseIndex, 0, maxPhaseIndex);
|
||||
if (GUILayout.Button("전환", GUILayout.Width(60)))
|
||||
{
|
||||
if (Application.isPlaying)
|
||||
if (Application.isPlaying && bossContext != null)
|
||||
{
|
||||
boss.ForcePhaseTransition(selectedPhaseIndex);
|
||||
bossContext.SetCurrentPatternPhase(selectedPhaseIndex + 1);
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
@@ -206,9 +170,9 @@ namespace Colosseum.Editor
|
||||
// 현재 페이즈 재시작
|
||||
if (GUILayout.Button("현재 페이즈 재시작"))
|
||||
{
|
||||
if (Application.isPlaying)
|
||||
if (Application.isPlaying && bossContext != null)
|
||||
{
|
||||
boss.RestartCurrentPhase();
|
||||
bossContext.RestartCurrentPhaseTimer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,17 +236,17 @@ namespace Colosseum.Editor
|
||||
EditorGUILayout.LabelField("커스텀 조건 설정", EditorStyles.boldLabel);
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField("조건 ID:", GUILayout.Width(60));
|
||||
string conditionId = EditorGUILayout.TextField("Enraged");
|
||||
customConditionId = EditorGUILayout.TextField(customConditionId);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("활성화"))
|
||||
{
|
||||
boss.SetCustomCondition(conditionId, true);
|
||||
bossContext?.SetPhaseCustomCondition(customConditionId, true);
|
||||
}
|
||||
if (GUILayout.Button("비활성화"))
|
||||
{
|
||||
boss.SetCustomCondition(conditionId, false);
|
||||
bossContext?.SetPhaseCustomCondition(customConditionId, false);
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
@@ -359,25 +323,8 @@ namespace Colosseum.Editor
|
||||
{
|
||||
if (boss.IsDead)
|
||||
return "<color=red>사망</color>";
|
||||
if (boss.IsTransitioning)
|
||||
return "<color=yellow>페이즈 전환 중</color>";
|
||||
return "<color=green>활성</color>";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 전환 조건 텍스트 반환
|
||||
/// </summary>
|
||||
private string GetTransitionConditionText(BossPhaseData phase)
|
||||
{
|
||||
return phase.TransitionType switch
|
||||
{
|
||||
PhaseTransitionType.HealthPercent => $"HP ≤ {phase.HealthPercentThreshold * 100:F0}%",
|
||||
PhaseTransitionType.TimeElapsed => $"시간 ≥ {phase.TimeThreshold:F0}초",
|
||||
PhaseTransitionType.CustomCondition => $"조건: {phase.CustomConditionId}",
|
||||
PhaseTransitionType.Manual => "수동 전환",
|
||||
_ => "알 수 없음"
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -84,8 +84,10 @@ namespace Colosseum.Editor
|
||||
{
|
||||
BossEnemy boss = FindBoss();
|
||||
if (boss == null) return;
|
||||
boss.RestartCurrentPhase();
|
||||
Debug.Log($"[Debug] 보스 현재 페이즈 재시작 | Phase={boss.CurrentPhaseIndex}");
|
||||
BossBehaviorRuntimeState context = boss.GetComponent<BossBehaviorRuntimeState>();
|
||||
if (context == null) return;
|
||||
context.RestartCurrentPhaseTimer();
|
||||
Debug.Log($"[Debug] 보스 현재 페이즈 재시작 | Phase={context.CurrentPatternPhase}");
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Colosseum/Debug/Boss/Respawn")]
|
||||
@@ -176,11 +178,10 @@ namespace Colosseum.Editor
|
||||
sb.AppendLine($"[Debug] 보스 상태 | {boss.name}");
|
||||
sb.AppendLine($" HP: {boss.CurrentHealth:F0} / {boss.MaxHealth:F0} ({(boss.MaxHealth > 0 ? boss.CurrentHealth / boss.MaxHealth * 100f : 0f):F1}%)");
|
||||
sb.AppendLine($" Shield: {boss.Shield:F0}");
|
||||
sb.AppendLine($" Phase: {boss.CurrentPhaseIndex + 1} / {boss.TotalPhases}");
|
||||
sb.AppendLine($" IsDead: {boss.IsDead}");
|
||||
|
||||
if (boss.CurrentPhase != null)
|
||||
sb.AppendLine($" PhaseName: {boss.CurrentPhase.PhaseName}");
|
||||
BossBehaviorRuntimeState context = boss.GetComponent<BossBehaviorRuntimeState>();
|
||||
if (context != null)
|
||||
sb.AppendLine($" Phase: {context.CurrentPatternPhase} / {context.MaxPatternPhase}");
|
||||
|
||||
Debug.Log(sb.ToString());
|
||||
}
|
||||
@@ -234,10 +235,12 @@ namespace Colosseum.Editor
|
||||
{
|
||||
BossEnemy boss = FindBoss();
|
||||
if (boss == null) return;
|
||||
BossBehaviorRuntimeState context = boss.GetComponent<BossBehaviorRuntimeState>();
|
||||
if (context == null) return;
|
||||
|
||||
index = Mathf.Clamp(index, 0, Mathf.Max(0, boss.TotalPhases - 1));
|
||||
boss.ForcePhaseTransition(index);
|
||||
Debug.Log($"[Debug] 보스 페이즈 강제 전환 | Phase={index}");
|
||||
int targetPhase = Mathf.Clamp(index + 1, 1, context.MaxPatternPhase);
|
||||
context.SetCurrentPatternPhase(targetPhase);
|
||||
Debug.Log($"[Debug] 보스 페이즈 강제 전환 | Phase={targetPhase}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
238
Assets/_Game/Scripts/Editor/FixDrogBTNodeTypes.cs
Normal file
238
Assets/_Game/Scripts/Editor/FixDrogBTNodeTypes.cs
Normal file
@@ -0,0 +1,238 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Colosseum.Editor
|
||||
{
|
||||
/// <summary>
|
||||
/// 드로그 BT 노드의 NodeType이 null인 문제를 수정합니다.
|
||||
/// NodeType이 없으면 런타임에서 behavior 노드를 인스턴스화할 수 없습니다.
|
||||
/// </summary>
|
||||
public static class FixDrogBTNodeTypes
|
||||
{
|
||||
private const string GraphAssetPath = "Assets/_Game/AI/BT_Drog.asset";
|
||||
|
||||
[MenuItem("Tools/Colosseum/Fix Drog BT NodeTypes")]
|
||||
private static void FixNodeTypes()
|
||||
{
|
||||
var graphAsset = AssetDatabase.LoadMainAssetAtPath(GraphAssetPath);
|
||||
if (graphAsset == null)
|
||||
{
|
||||
Debug.LogError("[FixDrogBT] BT 에셋을 찾을 수 없습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Type authoringGraphType = graphAsset.GetType();
|
||||
Assembly authoringAssembly = authoringGraphType.Assembly;
|
||||
Assembly runtimeAssembly = typeof(Unity.Behavior.BehaviorGraph).Assembly;
|
||||
|
||||
// 리플렉션 타입
|
||||
Type graphNodeModelType = null;
|
||||
Type nodeRegistryType = null;
|
||||
Type serializableTypeType = null;
|
||||
|
||||
foreach (var asm in AppDomain.CurrentDomain.GetAssemblies())
|
||||
{
|
||||
if (graphNodeModelType == null)
|
||||
graphNodeModelType = asm.GetType("Unity.Behavior.BehaviorGraphNodeModel");
|
||||
if (nodeRegistryType == null)
|
||||
nodeRegistryType = asm.GetType("Unity.Behavior.NodeRegistry");
|
||||
if (serializableTypeType == null)
|
||||
serializableTypeType = asm.GetType("Unity.Behavior.GraphFramework.SerializableType");
|
||||
}
|
||||
|
||||
if (graphNodeModelType == null || nodeRegistryType == null || serializableTypeType == null)
|
||||
{
|
||||
Debug.LogError("[FixDrogBT] 필수 리플렉션 타입을 찾지 못했습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
// NodeRegistry.GetInfo 메서드
|
||||
MethodInfo getNodeInfoMethod = nodeRegistryType.GetMethod("GetInfo",
|
||||
BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);
|
||||
|
||||
if (getNodeInfoMethod == null)
|
||||
{
|
||||
Debug.LogError("[FixDrogBT] NodeRegistry.GetInfo 메서드를 찾지 못했습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
// BehaviorGraphNodeModel.NodeType 필드
|
||||
FieldInfo nodeTypeField = graphNodeModelType.GetField("NodeType",
|
||||
BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
|
||||
if (nodeTypeField == null)
|
||||
{
|
||||
Debug.LogError("[FixDrogBT] NodeType 필드를 찾지 못했습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
// SerializableType 생성자 (string typeText)
|
||||
ConstructorInfo serializableTypeCtor = serializableTypeType.GetConstructor(new[] { typeof(string) });
|
||||
if (serializableTypeCtor == null)
|
||||
{
|
||||
Debug.LogError("[FixDrogBT] SerializableType(string) 생성자를 찾지 못했습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
// m_Nodes 필드
|
||||
FieldInfo nodesField = null;
|
||||
Type t = authoringGraphType;
|
||||
while (t != null)
|
||||
{
|
||||
nodesField = t.GetField("m_Nodes", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
|
||||
if (nodesField != null) break;
|
||||
t = t.BaseType;
|
||||
}
|
||||
|
||||
if (nodesField == null)
|
||||
{
|
||||
Debug.LogError("[FixDrogBT] m_Nodes 필드를 찾지 못했습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
var nodes = nodesField.GetValue(graphAsset) as IList;
|
||||
|
||||
// 노드 인덱스 → 런타임 타입 매핑 (위치 기반)
|
||||
// 현재 BT 노드 배치:
|
||||
// [0] StartNodeModel (420,-800)
|
||||
// [1] RepeatNodeModel (420,-620)
|
||||
// [4] BranchingConditionNodeModel (-800,-800) — Punish
|
||||
// [5] ActionNodeModel (-598,-581) — UsePatternByRole(Punish)
|
||||
// [8] BranchingConditionNodeModel (-800,-480) — Mobility/Leap
|
||||
// [9] ActionNodeModel (-598,-261) — UsePatternByRole(Mobility)
|
||||
// [12] BranchingConditionNodeModel (-800,-160) — Signature
|
||||
// [13] CompositeNodeModel (-580,-160) — Sequence(Signature)
|
||||
// [14] ActionNodeModel (-400,-160) — UsePatternByRole(Signature)
|
||||
// [17] BranchingConditionNodeModel (-580,20) — Outcome
|
||||
// [18] ActionNodeModel (-400,20) — SignatureFailureEffects
|
||||
// [19] ActionNodeModel (-400,200) — BossStagger
|
||||
// [22] BranchingConditionNodeModel (-800,160) — Combo
|
||||
// [23] CompositeNodeModel (-580,160) — Sequence(Combo)
|
||||
// [24] ActionNodeModel (-400,160) — UsePatternByRole(Combo)
|
||||
// [27] BranchingConditionNodeModel (-580,340) — Combo Leap
|
||||
// [28] ActionNodeModel (-400,340) — UsePatternByRole(ComboLeap)
|
||||
// [31] BranchingConditionNodeModel (-800,480) — Primary
|
||||
// [32] ActionNodeModel (-598,699) — UsePatternByRole(Primary)
|
||||
// [35] BranchingConditionNodeModel (-800,800) — Utility
|
||||
// [36] ActionNodeModel (-598,1019) — UsePatternByRole(Utility)
|
||||
// [37] CompositeNodeModel (-800,1120) — Sequence(Chase)
|
||||
// [38] ActionNodeModel (-640,1200) — RefreshPrimaryTarget
|
||||
// [39] ActionNodeModel (-480,1200) — ValidateTarget
|
||||
// [40] ActionNodeModel (-320,1200) — ChaseTarget
|
||||
|
||||
var nodeTypeMap = new Dictionary<int, Type>
|
||||
{
|
||||
[0] = runtimeAssembly.GetType("Unity.Behavior.Start"),
|
||||
[1] = runtimeAssembly.GetType("Unity.Behavior.RepeaterModifier"),
|
||||
[4] = runtimeAssembly.GetType("Unity.Behavior.BranchingConditionComposite"),
|
||||
[5] = typeof(UsePatternByRoleAction),
|
||||
[8] = runtimeAssembly.GetType("Unity.Behavior.BranchingConditionComposite"),
|
||||
[9] = typeof(UsePatternByRoleAction),
|
||||
[12] = runtimeAssembly.GetType("Unity.Behavior.BranchingConditionComposite"),
|
||||
[13] = runtimeAssembly.GetType("Unity.Behavior.SequenceComposite"),
|
||||
[14] = typeof(UsePatternByRoleAction),
|
||||
[17] = runtimeAssembly.GetType("Unity.Behavior.BranchingConditionComposite"),
|
||||
[18] = typeof(SignatureFailureEffectsAction),
|
||||
[19] = typeof(BossStaggerAction),
|
||||
[22] = runtimeAssembly.GetType("Unity.Behavior.BranchingConditionComposite"),
|
||||
[23] = runtimeAssembly.GetType("Unity.Behavior.SequenceComposite"),
|
||||
[24] = typeof(UsePatternByRoleAction),
|
||||
[27] = runtimeAssembly.GetType("Unity.Behavior.BranchingConditionComposite"),
|
||||
[28] = typeof(UsePatternByRoleAction),
|
||||
[31] = runtimeAssembly.GetType("Unity.Behavior.BranchingConditionComposite"),
|
||||
[32] = typeof(UsePatternByRoleAction),
|
||||
[35] = runtimeAssembly.GetType("Unity.Behavior.BranchingConditionComposite"),
|
||||
[36] = typeof(UsePatternByRoleAction),
|
||||
[37] = runtimeAssembly.GetType("Unity.Behavior.SequenceComposite"),
|
||||
[38] = typeof(RefreshPrimaryTargetAction),
|
||||
[39] = typeof(ValidateTargetAction),
|
||||
[40] = typeof(ChaseTargetAction),
|
||||
};
|
||||
|
||||
// Null 타입 제거
|
||||
var toRemove = new List<int>();
|
||||
foreach (var kvp in nodeTypeMap)
|
||||
if (kvp.Value == null) toRemove.Add(kvp.Key);
|
||||
foreach (var k in toRemove) nodeTypeMap.Remove(k);
|
||||
|
||||
int fixedCount = 0;
|
||||
int skippedCount = 0;
|
||||
int errorCount = 0;
|
||||
|
||||
for (int i = 0; i < nodes.Count; i++)
|
||||
{
|
||||
var node = nodes[i];
|
||||
|
||||
// BehaviorGraphNodeModel인지 확인
|
||||
if (!graphNodeModelType.IsAssignableFrom(node.GetType()))
|
||||
{
|
||||
skippedCount++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// 매핑에 없으면 건너뛰기
|
||||
if (!nodeTypeMap.TryGetValue(i, out Type runtimeType))
|
||||
{
|
||||
skippedCount++;
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// NodeRegistry.GetInfo에서 NodeInfo 획득
|
||||
object nodeInfo = getNodeInfoMethod.Invoke(null, new object[] { runtimeType });
|
||||
if (nodeInfo == null)
|
||||
{
|
||||
Debug.LogWarning($"[FixDrogBT] [{i}] NodeInfo를 찾지 못함: {runtimeType.FullName}");
|
||||
errorCount++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// NodeInfo에서 ModelType (SerializableType) 획득
|
||||
Type nodeInfoType = nodeInfo.GetType();
|
||||
FieldInfo modelTypeField = nodeInfoType.GetField("ModelType",
|
||||
BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
object modelSerializableType = modelTypeField?.GetValue(nodeInfo);
|
||||
|
||||
if (modelSerializableType == null)
|
||||
{
|
||||
Debug.LogWarning($"[FixDrogBT] [{i}] NodeInfo.ModelType이 null: {runtimeType.FullName}");
|
||||
errorCount++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// NodeType 필드에 SerializableType 설정
|
||||
nodeTypeField.SetValue(node, modelSerializableType);
|
||||
fixedCount++;
|
||||
Debug.Log($"[FixDrogBT] [{i}] {node.GetType().Name} → NodeType = {runtimeType.FullName}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError($"[FixDrogBT] [{i}] 설정 실패: {ex.GetType().Name}: {ex.Message}");
|
||||
errorCount++;
|
||||
}
|
||||
}
|
||||
|
||||
// 저장
|
||||
EditorUtility.SetDirty(graphAsset);
|
||||
AssetDatabase.SaveAssets();
|
||||
|
||||
// 재임포트하여 런타임 그래프 빌드 트리거
|
||||
AssetDatabase.ImportAsset(GraphAssetPath, ImportAssetOptions.ForceUpdate);
|
||||
|
||||
Debug.Log($"[FixDrogBT] 완료: 수정={fixedCount}, 건너뜀={skippedCount}, 오류={errorCount}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/_Game/Scripts/Editor/FixDrogBTNodeTypes.cs.meta
Normal file
2
Assets/_Game/Scripts/Editor/FixDrogBTNodeTypes.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3a07a3a98c1078611933a0d494e87684
|
||||
@@ -518,7 +518,14 @@ namespace Colosseum.Editor
|
||||
return;
|
||||
}
|
||||
|
||||
bossEnemy.ForcePhaseTransition(1);
|
||||
BossBehaviorRuntimeState context = bossEnemy.GetComponent<BossBehaviorRuntimeState>();
|
||||
if (context == null)
|
||||
{
|
||||
Debug.LogWarning("[Debug] BossBehaviorRuntimeState를 찾지 못했습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
context.SetCurrentPatternPhase(2);
|
||||
Debug.Log($"[Debug] 보스를 Phase 2로 강제 전환했습니다. | Target={bossEnemy.name}");
|
||||
}
|
||||
|
||||
@@ -1274,10 +1281,10 @@ namespace Colosseum.Editor
|
||||
return Object.FindFirstObjectByType<BossEnemy>();
|
||||
}
|
||||
|
||||
private static BossCombatBehaviorContext FindBossCombatContext()
|
||||
private static BossBehaviorRuntimeState FindBossBehaviorRuntimeState()
|
||||
{
|
||||
BossEnemy bossEnemy = FindBossEnemy();
|
||||
return bossEnemy != null ? bossEnemy.GetComponent<BossCombatBehaviorContext>() : null;
|
||||
return bossEnemy != null ? bossEnemy.GetComponent<BossBehaviorRuntimeState>() : null;
|
||||
}
|
||||
|
||||
private static void CastLocalSkill(int slotIndex)
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Reflection;
|
||||
using Colosseum.AI;
|
||||
using Colosseum.AI.BehaviorActions.Conditions;
|
||||
using Colosseum.Enemy;
|
||||
using Colosseum.Skills;
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
@@ -20,6 +21,26 @@ namespace Colosseum.Editor
|
||||
public static class RebuildDrogBehaviorAuthoringGraph
|
||||
{
|
||||
private const string GraphAssetPath = "Assets/_Game/AI/BT_Drog.asset";
|
||||
private const string DefaultPunishPatternPath = "Assets/_Game/Data/Patterns/Data_Pattern_Drog_밟기.asset";
|
||||
private const string DefaultSignaturePatternPath = "Assets/_Game/Data/Patterns/Data_Pattern_Drog_집행.asset";
|
||||
private const string DefaultMobilityPatternPath = "Assets/_Game/Data/Patterns/Data_Pattern_Drog_도약.asset";
|
||||
private const string DefaultSecondaryPatternPath = "Assets/_Game/Data/Patterns/Data_Pattern_Drog_연타2.asset";
|
||||
private const string DefaultComboPatternPath = "Assets/_Game/Data/Patterns/Data_Pattern_Drog_연타3-강타.asset";
|
||||
private const string DefaultPrimaryPatternPath = "Assets/_Game/Data/Patterns/Data_Pattern_Drog_연타1.asset";
|
||||
private const string DefaultPressurePatternPath = "Assets/_Game/Data/Patterns/Data_Pattern_Drog_연타4-발구르기.asset";
|
||||
private const string DefaultUtilityPatternPath = "Assets/_Game/Data/Patterns/Data_Pattern_Drog_투척.asset";
|
||||
private const string DefaultPhase3TransitionSkillPath = "Assets/_Game/Data/Skills/Data_Skill_Drog_포효.asset";
|
||||
|
||||
private const float DefaultDownedTargetSearchRadius = 6f;
|
||||
private const float DefaultLeapTargetMinDistance = 8f;
|
||||
private const float DefaultThrowTargetMinDistance = 5f;
|
||||
private const float DefaultPrimaryBranchAttackRange = 3f;
|
||||
private const float DefaultTargetSearchRange = 20f;
|
||||
private const float DefaultThrowAvailabilityDelay = 4f;
|
||||
private const float DefaultPhaseTransitionLockDuration = 1.25f;
|
||||
private const float DefaultPhase3SignatureDelay = 0.25f;
|
||||
private const float DefaultPhase2EnterHealthPercent = 75f;
|
||||
private const float DefaultPhase3EnterHealthPercent = 40f;
|
||||
|
||||
[MenuItem("Tools/Colosseum/Rebuild Drog Behavior Authoring Graph")]
|
||||
private static void Rebuild()
|
||||
@@ -172,7 +193,7 @@ namespace Colosseum.Editor
|
||||
}
|
||||
authoringGraphType = graphAsset.GetType();
|
||||
|
||||
object targetVariable = FindBlackboardVariableModel("Target");
|
||||
object targetVariable = EnsureBlackboardVariable<GameObject>("Target", null);
|
||||
if (targetVariable == null)
|
||||
{
|
||||
Debug.LogError("[DrogBTRebuild] Target 블랙보드 변수를 찾지 못했습니다.");
|
||||
@@ -180,43 +201,48 @@ namespace Colosseum.Editor
|
||||
}
|
||||
|
||||
// 구조 노드
|
||||
object startNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, runtimeAssembly.GetType("Unity.Behavior.Start", true), new Vector2(420f, -800f));
|
||||
object repeatNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, runtimeAssembly.GetType("Unity.Behavior.RepeaterModifier", true), new Vector2(420f, -620f));
|
||||
object startNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, runtimeAssembly.GetType("Unity.Behavior.Start", true), new Vector2(-1320f, -920f));
|
||||
object repeatNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, runtimeAssembly.GetType("Unity.Behavior.RepeaterModifier", true), new Vector2(-1320f, -720f));
|
||||
|
||||
// ── 프리팹에서 패턴 에셋 로드 ──
|
||||
const string prefabPath = "Assets/_Game/Prefabs/Bosses/Prefab_Boss_Drog.prefab";
|
||||
GameObject prefab = AssetDatabase.LoadMainAssetAtPath(prefabPath) as GameObject;
|
||||
BossCombatBehaviorContext context = prefab?.GetComponent<BossCombatBehaviorContext>();
|
||||
if (context == null)
|
||||
{
|
||||
Debug.LogError("[DrogBTRebuild] 드로그 프리팹에서 BossCombatBehaviorContext를 찾지 못했습니다.");
|
||||
return;
|
||||
}
|
||||
// ── 드로그 패턴과 판단 수치는 노드 로컬 값으로 두고, Target만 블랙보드로 공유합니다. ──
|
||||
RemoveBlackboardVariables(
|
||||
"PunishPattern",
|
||||
"SignaturePattern",
|
||||
"MobilityPattern",
|
||||
"ComboPattern",
|
||||
"PrimaryPattern",
|
||||
"UtilityPattern",
|
||||
"PunishSearchRadius",
|
||||
"MobilityTriggerDistance",
|
||||
"UtilityTriggerDistance",
|
||||
"PrimaryAttackRange",
|
||||
"Phase2HealthPercent",
|
||||
"Phase3HealthPercent",
|
||||
"SightRange",
|
||||
"AttackRange",
|
||||
"MoveSpeed");
|
||||
|
||||
// protected 필드에서 BossPatternData 에셋 읽기 (리플렉션)
|
||||
BossPatternData punishPattern = ReadProtectedField<BossPatternData>(context, "punishPattern");
|
||||
BossPatternData signaturePattern = ReadProtectedField<BossPatternData>(context, "signaturePattern");
|
||||
BossPatternData mobilityPattern = ReadProtectedField<BossPatternData>(context, "mobilityPattern");
|
||||
BossPatternData comboPattern = ReadProtectedField<BossPatternData>(context, "comboPattern");
|
||||
BossPatternData primaryPattern = ReadProtectedField<BossPatternData>(context, "primaryPattern");
|
||||
BossPatternData utilityPattern = ReadProtectedField<BossPatternData>(context, "utilityPattern");
|
||||
float punishSearchRadius = ReadProtectedFieldValue<float>(context, "punishSearchRadius", 6f);
|
||||
BossPatternData punishPattern = LoadRequiredAsset<BossPatternData>(DefaultPunishPatternPath, "밟기 패턴");
|
||||
BossPatternData signaturePattern = LoadRequiredAsset<BossPatternData>(DefaultSignaturePatternPath, "집행 개시 패턴");
|
||||
BossPatternData mobilityPattern = LoadRequiredAsset<BossPatternData>(DefaultMobilityPatternPath, "점프 패턴");
|
||||
BossPatternData secondaryPattern = LoadRequiredAsset<BossPatternData>(DefaultSecondaryPatternPath, "연타2 패턴");
|
||||
BossPatternData comboPattern = LoadRequiredAsset<BossPatternData>(DefaultComboPatternPath, "연타3-강타 패턴");
|
||||
BossPatternData primaryPattern = LoadRequiredAsset<BossPatternData>(DefaultPrimaryPatternPath, "기본 근접 패턴");
|
||||
BossPatternData pressurePattern = LoadRequiredAsset<BossPatternData>(DefaultPressurePatternPath, "연타4-발구르기 패턴");
|
||||
BossPatternData utilityPattern = LoadRequiredAsset<BossPatternData>(DefaultUtilityPatternPath, "투척 패턴");
|
||||
SkillData phase3TransitionSkill = LoadRequiredAsset<SkillData>(DefaultPhase3TransitionSkillPath, "Phase 3 포효 스킬");
|
||||
|
||||
// 필수 패턴 검증 (combo는 선택 — 할당되지 않은 경우 해당 Branch만 생략)
|
||||
if (punishPattern == null || signaturePattern == null || mobilityPattern == null ||
|
||||
primaryPattern == null || utilityPattern == null)
|
||||
secondaryPattern == null || comboPattern == null || primaryPattern == null || pressurePattern == null ||
|
||||
utilityPattern == null || phase3TransitionSkill == null)
|
||||
{
|
||||
Debug.LogError("[DrogBTRebuild] 프리팹에서 필수 패턴 에셋을 읽지 못했습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (comboPattern == null)
|
||||
Debug.LogWarning("[DrogBTRebuild] comboPattern이 할당되지 않았습니다. 해당 Branch를 생략합니다.");
|
||||
|
||||
// ── 계단식 우선순위 체인 ──
|
||||
// 설계안 우선순위: 다운 추가타 > 도약 > 집행 개시 > 기본 루프 > 조합 > 유틸리티
|
||||
// 각 Branch: CheckPatternReady → true → UsePatternByRole
|
||||
// false → 다음 우선순위 Branch 시도
|
||||
// 설계안 우선순위: 밟기 > 집행 개시 > 조합 > 도약 > 기본 루프 > 유틸리티
|
||||
// 각 Branch는 조건만 판정하고, 실제 대상 선택/검증/실행은 Sequence 내부 노드로 드러냅니다.
|
||||
// 마지막까지 모든 조건이 false이면 Chase (fallback)
|
||||
//
|
||||
// 연결 흐름: Branch.True → FloatingPort(True).InputPort → FloatingPort(True).OutputPort → Action.InputPort
|
||||
@@ -229,149 +255,257 @@ namespace Colosseum.Editor
|
||||
// Action: (-598, y + 199)
|
||||
|
||||
const float branchX = -800f;
|
||||
const float rootRefreshX = branchX - 540f;
|
||||
const float mainSequenceX = branchX + 340f;
|
||||
const float mainValidateX = branchX + 700f;
|
||||
const float mainUseX = branchX + 1100f;
|
||||
const float truePortOffsetX = 203f;
|
||||
const float truePortOffsetY = 120f;
|
||||
const float falsePortOffsetX = -211f;
|
||||
const float falsePortOffsetY = 124f;
|
||||
const float actionOffsetX = 202f;
|
||||
const float actionOffsetY = 219f;
|
||||
const float startY = -800f;
|
||||
const float stepY = 320f;
|
||||
const float startY = -700f;
|
||||
const float rootRefreshY = startY - 120f;
|
||||
const float stepY = 620f;
|
||||
const float nestedBranchOffsetY = 180f;
|
||||
const float nestedActionOffsetY = 360f;
|
||||
|
||||
// #1 Punish — 다운 추가타 (전제 조건: 다운된 대상이 반경 이내에 있어야 함)
|
||||
// 루프 시작마다 주 대상을 블랙보드에 동기화한 뒤 패턴 우선순위 체인으로 들어갑니다.
|
||||
object rootRefreshNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(RefreshPrimaryTargetAction), new Vector2(rootRefreshX, rootRefreshY));
|
||||
SetNodeFieldValue(rootRefreshNode, "SearchRange", DefaultTargetSearchRange, setFieldValueMethod);
|
||||
|
||||
// #1 Punish — 밟기 (전제 조건: 다운된 대상이 반경 이내에 있어야 함)
|
||||
object downBranch = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, branchCompositeType, new Vector2(branchX, startY));
|
||||
AttachPatternReadyCondition(downBranch, punishPattern, authoringAssembly);
|
||||
AttachConditionWithValue(downBranch, typeof(IsDownedTargetInRangeCondition), "searchRadius", punishSearchRadius, authoringAssembly);
|
||||
AttachConditionWithValue(downBranch, typeof(IsDownedTargetInRangeCondition), "SearchRadius", DefaultDownedTargetSearchRadius, authoringAssembly);
|
||||
AttachPhaseConditionIfNeeded(downBranch, punishPattern, authoringAssembly);
|
||||
SetBranchRequiresAll(downBranch, true);
|
||||
object downUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UsePatternByRoleAction), new Vector2(branchX + actionOffsetX, startY + actionOffsetY));
|
||||
|
||||
object downSequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod,
|
||||
runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true),
|
||||
new Vector2(mainSequenceX, startY));
|
||||
object downSelectNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(SelectNearestDownedTargetAction), new Vector2(mainValidateX, startY));
|
||||
SetNodeFieldValue(downSelectNode, "SearchRadius", DefaultDownedTargetSearchRadius, setFieldValueMethod);
|
||||
LinkTarget(downSelectNode, targetVariable);
|
||||
object downUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UsePatternByRoleAction), new Vector2(mainUseX, startY));
|
||||
SetNodeFieldValue(downUseNode, "Pattern", punishPattern, setFieldValueMethod);
|
||||
LinkTarget(downUseNode, targetVariable);
|
||||
ConnectChildren(graphAsset, connectEdgeMethod, downSequence, downSelectNode, downUseNode);
|
||||
|
||||
// #2 Mobility — 도약 (전제 조건: 지나치게 먼 대상이 존재해야 함)
|
||||
float mobilityTriggerDistance = ReadProtectedFieldValue<float>(context, "mobilityTriggerDistance", 8f);
|
||||
object leapBranch = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, branchCompositeType, new Vector2(branchX, startY + stepY));
|
||||
AttachPatternReadyCondition(leapBranch, mobilityPattern, authoringAssembly);
|
||||
AttachConditionWithValue(leapBranch, typeof(IsTargetBeyondDistanceCondition), "minDistance", mobilityTriggerDistance, authoringAssembly);
|
||||
AttachPhaseConditionIfNeeded(leapBranch, mobilityPattern, authoringAssembly);
|
||||
SetBranchRequiresAll(leapBranch, true);
|
||||
object leapUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UsePatternByRoleAction), new Vector2(branchX + actionOffsetX, startY + stepY + actionOffsetY));
|
||||
SetNodeFieldValue(leapUseNode, "Pattern", mobilityPattern, setFieldValueMethod);
|
||||
LinkTarget(leapUseNode, targetVariable);
|
||||
|
||||
// #3 Signature — 집행 개시 (Sequence: 패턴 실행 → 결과 분기)
|
||||
// #2 Signature — 집행 개시 (Sequence: 패턴 실행 → 결과 분기)
|
||||
// signatureBranch.True → Sequence:
|
||||
// Child 1: 집행개시 패턴 실행 (ChargeWait 포함)
|
||||
// Child 2: Branch(패턴 성공? = 차단 안 됨) → 범위 효과 또는 보스 경직
|
||||
// 패턴이 Failure 반환(차단 성공) → Sequence Failure → signatureBranch False → 다음 우선순위
|
||||
object signatureBranch = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, branchCompositeType, new Vector2(branchX, startY + stepY * 2));
|
||||
// Child 1: 현재 주 대상 검증
|
||||
// Child 2: 집행개시 패턴 실행 (ChargeWait 포함)
|
||||
// Child 3: Branch(차단 성공 여부) → 보스 경직 또는 범위 효과
|
||||
object signatureBranch = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, branchCompositeType, new Vector2(branchX, startY + stepY));
|
||||
AttachPatternReadyCondition(signatureBranch, signaturePattern, authoringAssembly);
|
||||
AttachPhaseConditionIfNeeded(signatureBranch, signaturePattern, authoringAssembly);
|
||||
AttachConditionWithValue(signatureBranch, typeof(IsPhaseElapsedTimeAboveCondition), "Seconds", DefaultPhase3SignatureDelay, authoringAssembly);
|
||||
SetBranchRequiresAll(signatureBranch, true);
|
||||
|
||||
// Sequence: 패턴 실행 → 결과 분기
|
||||
object signatureSequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod,
|
||||
runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true),
|
||||
new Vector2(branchX + 220f, startY + stepY * 2));
|
||||
new Vector2(mainSequenceX, startY + stepY));
|
||||
|
||||
// Child 1: 집행개시 패턴 실행
|
||||
object signatureUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UsePatternByRoleAction), new Vector2(branchX + 400f, startY + stepY * 2));
|
||||
object signatureValidateNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(ValidateTargetAction), new Vector2(mainValidateX, startY + stepY));
|
||||
LinkTarget(signatureValidateNode, targetVariable);
|
||||
|
||||
// Child 2: 집행 패턴 실행
|
||||
object signatureUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UsePatternByRoleAction), new Vector2(mainUseX, startY + stepY));
|
||||
SetNodeFieldValue(signatureUseNode, "Pattern", signaturePattern, setFieldValueMethod);
|
||||
SetNodeFieldValue(signatureUseNode, "ContinueOnResolvedFailure", true, setFieldValueMethod);
|
||||
LinkTarget(signatureUseNode, targetVariable);
|
||||
|
||||
// Child 2: 패턴 완료 시 결과 분기
|
||||
// 패턴이 Success 반환(차단 안 됨 = 충전 완료) → True → 실패 효과 적용
|
||||
// 패턴이 Failure 반환(차단 성공) → False → 보스 경직
|
||||
object outcomeBranch = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, branchCompositeType, new Vector2(branchX + 220f, startY + stepY * 2 + 180f));
|
||||
// Child 3: 패턴 완료 시 결과 분기
|
||||
// 패턴이 실패 결과로 끝나면 True → 보스 경직, 성공적으로 완수되면 False → 범위 효과 적용
|
||||
object outcomeBranch = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, branchCompositeType, new Vector2(mainUseX + 320f, startY + stepY));
|
||||
AttachConditionWithValue(outcomeBranch, typeof(IsPatternExecutionResultCondition), "Result", BossPatternExecutionResult.Failed, authoringAssembly);
|
||||
|
||||
object failureEffectsNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(SignatureFailureEffectsAction), new Vector2(branchX + 400f, startY + stepY * 2 + 180f));
|
||||
object staggerNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(BossStaggerAction), new Vector2(branchX + 400f, startY + stepY * 2 + 360f));
|
||||
object staggerNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(BossStaggerAction), new Vector2(mainUseX + 520f, startY + stepY + nestedBranchOffsetY));
|
||||
object failureEffectsNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(SignatureFailureEffectsAction), new Vector2(mainUseX + 520f, startY + stepY + nestedActionOffsetY));
|
||||
|
||||
// outcomeBranch True → 실패 효과 (충전 완료 = 플레이어들이 차단 실패)
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, outcomeBranch, "True", failureEffectsNode);
|
||||
// outcomeBranch False → 보스 경직 (차단 성공)
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, outcomeBranch, "False", staggerNode);
|
||||
// outcomeBranch True → 보스 경직 (패턴 실패 결과)
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, outcomeBranch, "True", staggerNode);
|
||||
// outcomeBranch False → 실패 효과 (패턴 성공 완수)
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, outcomeBranch, "False", failureEffectsNode);
|
||||
|
||||
// Sequence에 자식 연결
|
||||
ConnectChildren(graphAsset, connectEdgeMethod, signatureSequence, signatureUseNode, outcomeBranch);
|
||||
ConnectChildren(graphAsset, connectEdgeMethod, signatureSequence, signatureValidateNode, signatureUseNode, outcomeBranch);
|
||||
|
||||
// 메인 체인: signatureBranch.True → Sequence
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, signatureBranch, "True", signatureSequence);
|
||||
|
||||
// #4 Combo — 콤보 패턴 + 조건부 도약 (Sequence)
|
||||
// comboBranch.True → Sequence:
|
||||
// Child 1: 연타2-강타 실행
|
||||
// Child 2: Branch(거리 초과 대상 존재) → 도약 실행
|
||||
// 거리 초과 대상이 없으면 Branch Failure → Sequence Failure → comboBranch Failure → primaryBranch로 연결
|
||||
object comboBranch = null;
|
||||
object comboUseNode = null;
|
||||
if (comboPattern != null)
|
||||
{
|
||||
// 메인 체인용 Branch (콤보 준비 + 페이즈 조건)
|
||||
comboBranch = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, branchCompositeType, new Vector2(branchX, startY + stepY * 3));
|
||||
AttachPatternReadyCondition(comboBranch, comboPattern, authoringAssembly);
|
||||
AttachPhaseConditionIfNeeded(comboBranch, comboPattern, authoringAssembly);
|
||||
SetBranchRequiresAll(comboBranch, true);
|
||||
// #3 Combo — 연타3-강타
|
||||
object comboBranch = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, branchCompositeType, new Vector2(branchX, startY + stepY * 2));
|
||||
AttachPatternReadyCondition(comboBranch, comboPattern, authoringAssembly);
|
||||
AttachPhaseConditionIfNeeded(comboBranch, comboPattern, authoringAssembly);
|
||||
SetBranchRequiresAll(comboBranch, true);
|
||||
|
||||
// Sequence: 콤보 실행 → 조건부 도약
|
||||
object comboSequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod,
|
||||
runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true),
|
||||
new Vector2(branchX + 220f, startY + stepY * 3));
|
||||
object comboSequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod,
|
||||
runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true),
|
||||
new Vector2(mainSequenceX, startY + stepY * 2));
|
||||
object comboValidateNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(ValidateTargetAction), new Vector2(mainValidateX, startY + stepY * 2));
|
||||
LinkTarget(comboValidateNode, targetVariable);
|
||||
object comboUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UsePatternByRoleAction), new Vector2(mainUseX, startY + stepY * 2));
|
||||
SetNodeFieldValue(comboUseNode, "Pattern", comboPattern, setFieldValueMethod);
|
||||
LinkTarget(comboUseNode, targetVariable);
|
||||
ConnectChildren(graphAsset, connectEdgeMethod, comboSequence, comboValidateNode, comboUseNode);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, comboBranch, "True", comboSequence);
|
||||
|
||||
// Child 1: 콤보 패턴 실행 (연타2-강타 + 대기)
|
||||
comboUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UsePatternByRoleAction), new Vector2(branchX + 400f, startY + stepY * 3));
|
||||
SetNodeFieldValue(comboUseNode, "Pattern", comboPattern, setFieldValueMethod);
|
||||
LinkTarget(comboUseNode, targetVariable);
|
||||
// #4 Mobility — 도약 (전제 조건: 지나치게 먼 대상이 존재해야 함)
|
||||
object leapBranch = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, branchCompositeType, new Vector2(branchX, startY + stepY * 3));
|
||||
AttachPatternReadyCondition(leapBranch, mobilityPattern, authoringAssembly);
|
||||
AttachConditionWithValue(leapBranch, typeof(IsTargetBeyondDistanceCondition), "MinDistance", DefaultLeapTargetMinDistance, authoringAssembly);
|
||||
AttachPhaseConditionIfNeeded(leapBranch, mobilityPattern, authoringAssembly);
|
||||
SetBranchRequiresAll(leapBranch, true);
|
||||
object leapSequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod,
|
||||
runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true),
|
||||
new Vector2(mainSequenceX, startY + stepY * 3));
|
||||
object leapSelectNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(SelectTargetByDistanceAction), new Vector2(mainValidateX, startY + stepY * 3));
|
||||
SetNodeFieldValue(leapSelectNode, "MinRange", DefaultLeapTargetMinDistance, setFieldValueMethod);
|
||||
SetNodeFieldValue(leapSelectNode, "MaxRange", DefaultTargetSearchRange, setFieldValueMethod);
|
||||
SetNodeFieldValue(leapSelectNode, "SelectionMode", DistanceTargetSelectionMode.Farthest, setFieldValueMethod);
|
||||
LinkTarget(leapSelectNode, targetVariable);
|
||||
object leapUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UsePatternByRoleAction), new Vector2(mainUseX, startY + stepY * 3));
|
||||
SetNodeFieldValue(leapUseNode, "Pattern", mobilityPattern, setFieldValueMethod);
|
||||
LinkTarget(leapUseNode, targetVariable);
|
||||
ConnectChildren(graphAsset, connectEdgeMethod, leapSequence, leapSelectNode, leapUseNode);
|
||||
|
||||
// Child 2: 조건부 도약 (거리 초과 대상 있을 때만)
|
||||
object comboLeapBranch = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, branchCompositeType, new Vector2(branchX + 220f, startY + stepY * 3 + 180f));
|
||||
AttachConditionWithValue(comboLeapBranch, typeof(IsTargetBeyondDistanceCondition), "minDistance", mobilityTriggerDistance, authoringAssembly);
|
||||
object comboLeapUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UsePatternByRoleAction), new Vector2(branchX + 400f, startY + stepY * 3 + 180f));
|
||||
SetNodeFieldValue(comboLeapUseNode, "Pattern", mobilityPattern, setFieldValueMethod);
|
||||
LinkTarget(comboLeapUseNode, targetVariable);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, comboLeapBranch, "True", comboLeapUseNode);
|
||||
|
||||
// Sequence에 자식 연결
|
||||
ConnectChildren(graphAsset, connectEdgeMethod, comboSequence, comboUseNode, comboLeapBranch);
|
||||
|
||||
// 메인 체인: comboBranch.True → Sequence
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, comboBranch, "True", comboSequence);
|
||||
}
|
||||
|
||||
// #5 Primary — 사거리 + 기본 패턴 준비 (모두 충족)
|
||||
// #5 Primary — 연타1
|
||||
object primaryBranch = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, branchCompositeType, new Vector2(branchX, startY + stepY * 4));
|
||||
object primaryRangeCondModel = AttachCondition(primaryBranch, typeof(IsTargetInAttackRangeCondition), authoringAssembly);
|
||||
if (primaryRangeCondModel != null) setFieldMethod.Invoke(primaryRangeCondModel, new object[] { "Target", targetVariable, typeof(GameObject) });
|
||||
if (primaryRangeCondModel != null) SetConditionFieldValue(primaryRangeCondModel, "AttackRange", DefaultPrimaryBranchAttackRange);
|
||||
AttachPatternReadyCondition(primaryBranch, primaryPattern, authoringAssembly);
|
||||
AttachPhaseConditionIfNeeded(primaryBranch, primaryPattern, authoringAssembly);
|
||||
SetBranchRequiresAll(primaryBranch, true);
|
||||
object primaryUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UsePatternByRoleAction), new Vector2(branchX + actionOffsetX, startY + stepY * 4 + actionOffsetY));
|
||||
object primarySequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod,
|
||||
runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true),
|
||||
new Vector2(mainSequenceX, startY + stepY * 4));
|
||||
object primaryValidateNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(ValidateTargetAction), new Vector2(mainValidateX, startY + stepY * 4));
|
||||
LinkTarget(primaryValidateNode, targetVariable);
|
||||
object primaryUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UsePatternByRoleAction), new Vector2(mainUseX, startY + stepY * 4));
|
||||
SetNodeFieldValue(primaryUseNode, "Pattern", primaryPattern, setFieldValueMethod);
|
||||
LinkTarget(primaryUseNode, targetVariable);
|
||||
ConnectChildren(graphAsset, connectEdgeMethod, primarySequence, primaryValidateNode, primaryUseNode);
|
||||
|
||||
// #6 Utility — 유틸리티 (전제 조건: 원거리 대상이 존재해야 함)
|
||||
float utilityTriggerDistance = ReadProtectedFieldValue<float>(context, "utilityTriggerDistance", 5f);
|
||||
object utilityBranch = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, branchCompositeType, new Vector2(branchX, startY + stepY * 5));
|
||||
// #6 Secondary Basic — 연타2
|
||||
object secondaryBranch = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, branchCompositeType, new Vector2(branchX, startY + stepY * 5));
|
||||
object secondaryRangeCondModel = AttachCondition(secondaryBranch, typeof(IsTargetInAttackRangeCondition), authoringAssembly);
|
||||
if (secondaryRangeCondModel != null) setFieldMethod.Invoke(secondaryRangeCondModel, new object[] { "Target", targetVariable, typeof(GameObject) });
|
||||
if (secondaryRangeCondModel != null) SetConditionFieldValue(secondaryRangeCondModel, "AttackRange", DefaultPrimaryBranchAttackRange);
|
||||
AttachPatternReadyCondition(secondaryBranch, secondaryPattern, authoringAssembly);
|
||||
AttachPhaseConditionIfNeeded(secondaryBranch, secondaryPattern, authoringAssembly);
|
||||
SetBranchRequiresAll(secondaryBranch, true);
|
||||
object secondarySequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod,
|
||||
runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true),
|
||||
new Vector2(mainSequenceX, startY + stepY * 5));
|
||||
object secondaryValidateNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(ValidateTargetAction), new Vector2(mainValidateX, startY + stepY * 5));
|
||||
LinkTarget(secondaryValidateNode, targetVariable);
|
||||
object secondaryUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UsePatternByRoleAction), new Vector2(mainUseX, startY + stepY * 5));
|
||||
SetNodeFieldValue(secondaryUseNode, "Pattern", secondaryPattern, setFieldValueMethod);
|
||||
LinkTarget(secondaryUseNode, targetVariable);
|
||||
ConnectChildren(graphAsset, connectEdgeMethod, secondarySequence, secondaryValidateNode, secondaryUseNode);
|
||||
|
||||
// #7 Pressure — 연타4-발구르기
|
||||
object pressureBranch = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, branchCompositeType, new Vector2(branchX, startY + stepY * 6));
|
||||
object pressureRangeCondModel = AttachCondition(pressureBranch, typeof(IsTargetInAttackRangeCondition), authoringAssembly);
|
||||
if (pressureRangeCondModel != null) setFieldMethod.Invoke(pressureRangeCondModel, new object[] { "Target", targetVariable, typeof(GameObject) });
|
||||
if (pressureRangeCondModel != null) SetConditionFieldValue(pressureRangeCondModel, "AttackRange", DefaultPrimaryBranchAttackRange);
|
||||
AttachPatternReadyCondition(pressureBranch, pressurePattern, authoringAssembly);
|
||||
AttachPhaseConditionIfNeeded(pressureBranch, pressurePattern, authoringAssembly);
|
||||
SetBranchRequiresAll(pressureBranch, true);
|
||||
object pressureSequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod,
|
||||
runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true),
|
||||
new Vector2(mainSequenceX, startY + stepY * 6));
|
||||
object pressureValidateNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(ValidateTargetAction), new Vector2(mainValidateX, startY + stepY * 6));
|
||||
LinkTarget(pressureValidateNode, targetVariable);
|
||||
object pressureUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UsePatternByRoleAction), new Vector2(mainUseX, startY + stepY * 6));
|
||||
SetNodeFieldValue(pressureUseNode, "Pattern", pressurePattern, setFieldValueMethod);
|
||||
LinkTarget(pressureUseNode, targetVariable);
|
||||
ConnectChildren(graphAsset, connectEdgeMethod, pressureSequence, pressureValidateNode, pressureUseNode);
|
||||
|
||||
// #8 Utility — 유틸리티 (전제 조건: 원거리 대상이 존재해야 함)
|
||||
object utilityBranch = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, branchCompositeType, new Vector2(branchX, startY + stepY * 7));
|
||||
AttachPatternReadyCondition(utilityBranch, utilityPattern, authoringAssembly);
|
||||
AttachConditionWithValue(utilityBranch, typeof(IsTargetBeyondDistanceCondition), "minDistance", utilityTriggerDistance, authoringAssembly);
|
||||
AttachConditionWithValue(utilityBranch, typeof(IsTargetBeyondDistanceCondition), "MinDistance", DefaultThrowTargetMinDistance, authoringAssembly);
|
||||
AttachConditionWithValue(utilityBranch, typeof(IsPhaseElapsedTimeAboveCondition), "Seconds", DefaultThrowAvailabilityDelay, authoringAssembly);
|
||||
AttachPhaseConditionIfNeeded(utilityBranch, utilityPattern, authoringAssembly);
|
||||
SetBranchRequiresAll(utilityBranch, true);
|
||||
object utilityUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UsePatternByRoleAction), new Vector2(branchX + actionOffsetX, startY + stepY * 5 + actionOffsetY));
|
||||
object utilitySequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod,
|
||||
runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true),
|
||||
new Vector2(mainSequenceX, startY + stepY * 7));
|
||||
object utilitySelectNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(SelectAlternateTargetByDistanceAction), new Vector2(mainValidateX, startY + stepY * 7));
|
||||
SetNodeFieldValue(utilitySelectNode, "MinRange", DefaultThrowTargetMinDistance, setFieldValueMethod);
|
||||
SetNodeFieldValue(utilitySelectNode, "MaxRange", DefaultTargetSearchRange, setFieldValueMethod);
|
||||
LinkTarget(utilitySelectNode, targetVariable);
|
||||
object utilityUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UsePatternByRoleAction), new Vector2(mainUseX, startY + stepY * 7));
|
||||
SetNodeFieldValue(utilityUseNode, "Pattern", utilityPattern, setFieldValueMethod);
|
||||
LinkTarget(utilityUseNode, targetVariable);
|
||||
ConnectChildren(graphAsset, connectEdgeMethod, utilitySequence, utilitySelectNode, utilityUseNode);
|
||||
|
||||
// #7 Chase — fallback (Branch 아님, Sequence 사용)
|
||||
object chaseSequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true), new Vector2(branchX, startY + stepY * 6));
|
||||
object chaseRefreshNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(RefreshPrimaryTargetAction), new Vector2(branchX + 160f, startY + stepY * 6 + 80f));
|
||||
object chaseHasTargetNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(ValidateTargetAction), new Vector2(branchX + 320f, startY + stepY * 6 + 80f));
|
||||
object chaseUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(ChaseTargetAction), new Vector2(branchX + 480f, startY + stepY * 6 + 80f));
|
||||
// #9 Chase — fallback (Branch 아님, Sequence 사용)
|
||||
object chaseSequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true), new Vector2(branchX, startY + stepY * 8));
|
||||
object chaseRefreshNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(RefreshPrimaryTargetAction), new Vector2(branchX + 160f, startY + stepY * 8 + 80f));
|
||||
SetNodeFieldValue(chaseRefreshNode, "SearchRange", DefaultTargetSearchRange, setFieldValueMethod);
|
||||
object chaseHasTargetNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(ValidateTargetAction), new Vector2(branchX + 320f, startY + stepY * 8 + 80f));
|
||||
object chaseUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(ChaseTargetAction), new Vector2(branchX + 480f, startY + stepY * 8 + 80f));
|
||||
SetNodeFieldValue(chaseUseNode, "StopDistance", DefaultPrimaryBranchAttackRange, setFieldValueMethod);
|
||||
|
||||
Connect(graphAsset, connectEdgeMethod, GetDefaultOutputPort(rootRefreshNode), GetDefaultInputPort(downBranch));
|
||||
|
||||
List<object> phaseBranches = new List<object>();
|
||||
object phaseEntryNode = null;
|
||||
object previousPhaseBranch = null;
|
||||
|
||||
object phase2Branch = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, branchCompositeType, new Vector2(branchX, -1320f));
|
||||
AttachConditionWithValue(phase2Branch, typeof(IsCurrentPhaseCondition), "Phase", 1, authoringAssembly);
|
||||
AttachConditionWithValue(phase2Branch, typeof(IsHealthBelowCondition), "HealthPercent", DefaultPhase2EnterHealthPercent, authoringAssembly);
|
||||
SetBranchRequiresAll(phase2Branch, true);
|
||||
phaseBranches.Add(phase2Branch);
|
||||
phaseEntryNode = phase2Branch;
|
||||
|
||||
object phase2Sequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod,
|
||||
runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true),
|
||||
new Vector2(mainSequenceX, -1320f));
|
||||
object phase2TransitionWaitNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(WaitAction), new Vector2(mainValidateX, -1320f));
|
||||
SetNodeFieldValue(phase2TransitionWaitNode, "Duration", DefaultPhaseTransitionLockDuration, setFieldValueMethod);
|
||||
object phase2SetNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(SetBossPhaseAction), new Vector2(mainUseX, -1320f));
|
||||
SetNodeFieldValue(phase2SetNode, "TargetPhase", 2, setFieldValueMethod);
|
||||
ConnectChildren(graphAsset, connectEdgeMethod, phase2Sequence, phase2TransitionWaitNode, phase2SetNode);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, phase2Branch, "True", phase2Sequence);
|
||||
|
||||
object phase3Branch = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, branchCompositeType, new Vector2(branchX, -1040f));
|
||||
AttachConditionWithValue(phase3Branch, typeof(IsCurrentPhaseCondition), "Phase", 2, authoringAssembly);
|
||||
AttachConditionWithValue(phase3Branch, typeof(IsHealthBelowCondition), "HealthPercent", DefaultPhase3EnterHealthPercent, authoringAssembly);
|
||||
SetBranchRequiresAll(phase3Branch, true);
|
||||
phaseBranches.Add(phase3Branch);
|
||||
|
||||
object phase3Sequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod,
|
||||
runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true),
|
||||
new Vector2(mainSequenceX, -1040f));
|
||||
object phase3TransitionWaitNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(WaitAction), new Vector2(mainValidateX, -1040f));
|
||||
SetNodeFieldValue(phase3TransitionWaitNode, "Duration", DefaultPhaseTransitionLockDuration, setFieldValueMethod);
|
||||
object phase3RoarNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UseSkillAction), new Vector2(mainValidateX + 180f, -1040f));
|
||||
SetNodeFieldValue(phase3RoarNode, "스킬", phase3TransitionSkill, setFieldValueMethod);
|
||||
object phase3SetNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(SetBossPhaseAction), new Vector2(mainUseX, -1040f));
|
||||
SetNodeFieldValue(phase3SetNode, "TargetPhase", 3, setFieldValueMethod);
|
||||
ConnectChildren(graphAsset, connectEdgeMethod, phase3Sequence, phase3TransitionWaitNode, phase3RoarNode, phase3SetNode);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, phase3Branch, "True", phase3Sequence);
|
||||
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, phase2Branch, "False", phase3Branch);
|
||||
previousPhaseBranch = phase3Branch;
|
||||
|
||||
if (previousPhaseBranch != null)
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, previousPhaseBranch, "False", rootRefreshNode);
|
||||
|
||||
// ── FloatingPortNodeModel 생성 + 위치 보정 ──
|
||||
// Branch 노드의 NamedPort(True/False)에 대해 FloatingPortNodeModel을 생성합니다.
|
||||
// CreateNodePortsForNode는 기본 위치(Branch + 200px Y)를 사용하므로, 생성 후 사용자 조정 기준 위치로 이동합니다.
|
||||
var allBranches = new List<object> { downBranch, leapBranch, signatureBranch, outcomeBranch };
|
||||
if (comboBranch != null) allBranches.Add(comboBranch);
|
||||
allBranches.AddRange(new[] { primaryBranch, utilityBranch });
|
||||
var allBranches = new List<object>();
|
||||
allBranches.AddRange(phaseBranches);
|
||||
allBranches.AddRange(new[] { downBranch, leapBranch, signatureBranch, outcomeBranch });
|
||||
allBranches.AddRange(new[] { comboBranch, primaryBranch, secondaryBranch, pressureBranch, utilityBranch });
|
||||
foreach (object branch in allBranches)
|
||||
{
|
||||
createNodePortsMethod?.Invoke(graphAsset, new object[] { branch });
|
||||
@@ -392,32 +526,35 @@ namespace Colosseum.Editor
|
||||
|
||||
// ── 연결 ──
|
||||
|
||||
// Start → Repeater → 첫 번째 Branch
|
||||
// Start → Repeater → phaseEntry(페이즈 전환 조건 -> 전투 의사결정 체인)
|
||||
Connect(graphAsset, connectEdgeMethod, GetDefaultOutputPort(startNode), GetDefaultInputPort(repeatNode));
|
||||
Connect(graphAsset, connectEdgeMethod, GetDefaultOutputPort(repeatNode), GetDefaultInputPort(downBranch));
|
||||
Connect(graphAsset, connectEdgeMethod, GetDefaultOutputPort(repeatNode), GetDefaultInputPort(phaseEntryNode));
|
||||
|
||||
// 각 Branch의 True FloatingPort → Action (combo, signature는 내부에서 Sequence로 연결됨)
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, downBranch, "True", downUseNode);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, leapBranch, "True", leapUseNode);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, downBranch, "True", downSequence);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, leapBranch, "True", leapSequence);
|
||||
// signatureBranch.True는 signatureSequence에 이미 연결됨
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, primaryBranch, "True", primaryUseNode);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, utilityBranch, "True", utilityUseNode);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, comboBranch, "True", comboSequence);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, primaryBranch, "True", primarySequence);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, secondaryBranch, "True", secondarySequence);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, pressureBranch, "True", pressureSequence);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, utilityBranch, "True", utilitySequence);
|
||||
|
||||
// 각 Branch의 False FloatingPort → 다음 우선순위 (계단식 체인)
|
||||
// combo 유무에 따라 연결 경로가 달라짐
|
||||
object afterSignature = comboBranch ?? primaryBranch;
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, downBranch, "False", leapBranch);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, leapBranch, "False", signatureBranch);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, signatureBranch, "False", afterSignature);
|
||||
if (comboBranch != null)
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, comboBranch, "False", primaryBranch);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, primaryBranch, "False", utilityBranch);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, downBranch, "False", signatureBranch);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, signatureBranch, "False", comboBranch);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, comboBranch, "False", leapBranch);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, leapBranch, "False", primaryBranch);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, primaryBranch, "False", secondaryBranch);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, secondaryBranch, "False", pressureBranch);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, pressureBranch, "False", utilityBranch);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, utilityBranch, "False", chaseSequence);
|
||||
|
||||
// Chase Sequence 자식 연결
|
||||
ConnectChildren(graphAsset, connectEdgeMethod, chaseSequence, chaseRefreshNode, chaseHasTargetNode, chaseUseNode);
|
||||
|
||||
// Chase 노드 블랙보드 변수 연결
|
||||
// Chase/루트 노드 블랙보드 변수 연결
|
||||
LinkTarget(rootRefreshNode, targetVariable);
|
||||
LinkTarget(chaseRefreshNode, targetVariable);
|
||||
LinkTarget(chaseHasTargetNode, targetVariable);
|
||||
LinkTarget(chaseUseNode, targetVariable);
|
||||
@@ -569,15 +706,6 @@ namespace Colosseum.Editor
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ConditionModel의 필드를 블랙보드 변수에 연결합니다.
|
||||
/// </summary>
|
||||
private static void LinkConditionFieldToVariable(object conditionModel, string fieldName, Type fieldType, object variableModel)
|
||||
{
|
||||
MethodInfo setFieldMethod = conditionModel.GetType().GetMethod("SetField", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
setFieldMethod?.Invoke(conditionModel, new object[] { fieldName, variableModel, fieldType });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Condition을 부착하고, 지정된 enum 필드 값을 설정합니다.
|
||||
/// CheckPatternReadyCondition처럼 필드 값으로 역할을 구분하는 Condition에 사용합니다.
|
||||
@@ -613,6 +741,31 @@ namespace Colosseum.Editor
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetConditionFieldValue(object conditionModel, string fieldName, object fieldValue)
|
||||
{
|
||||
if (conditionModel == null || fieldValue == null)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
MethodInfo genericSetField = conditionModel.GetType().GetMethods(BindingFlags.Instance | BindingFlags.NonPublic)
|
||||
.FirstOrDefault(method => method.Name == "SetField" && method.IsGenericMethod && method.GetParameters().Length == 2);
|
||||
|
||||
if (genericSetField == null)
|
||||
{
|
||||
Debug.LogWarning($"[DrogBTRebuild] SetConditionFieldValue: '{fieldName}' 필드 설정 메서드를 찾지 못했습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
MethodInfo closedMethod = genericSetField.MakeGenericMethod(fieldValue.GetType());
|
||||
closedMethod.Invoke(conditionModel, new object[] { fieldName, fieldValue });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError($"[DrogBTRebuild] SetConditionFieldValue 실패 ({fieldName}): {ex.GetType().Name}: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 노드 모델의 지정된 enum 필드 값을 설정합니다.
|
||||
/// UsePatternByRoleAction처럼 필드 값으로 역할을 구분하는 Action에 사용합니다.
|
||||
@@ -701,35 +854,80 @@ namespace Colosseum.Editor
|
||||
return success ? parameters[0] : null;
|
||||
}
|
||||
|
||||
private static object FindBlackboardVariableModel(string variableName)
|
||||
private static IList GetBlackboardVariables(UnityEngine.Object blackboardAsset)
|
||||
{
|
||||
UnityEngine.Object blackboardAsset = AssetDatabase.LoadAllAssetsAtPath(GraphAssetPath)
|
||||
.FirstOrDefault(asset => asset != null && asset.GetType().Name.Contains("BehaviorBlackboardAuthoringAsset", StringComparison.Ordinal));
|
||||
|
||||
if (blackboardAsset == null)
|
||||
return null;
|
||||
|
||||
PropertyInfo variablesProperty = blackboardAsset.GetType().GetProperty("Variables", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
FieldInfo variablesField = blackboardAsset.GetType().GetField("m_Variables", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
IEnumerable variables = variablesProperty?.GetValue(blackboardAsset) as IEnumerable ?? variablesField?.GetValue(blackboardAsset) as IEnumerable;
|
||||
if (variables == null)
|
||||
return null;
|
||||
return variablesProperty?.GetValue(blackboardAsset) as IList ?? variablesField?.GetValue(blackboardAsset) as IList;
|
||||
}
|
||||
|
||||
foreach (object variable in variables)
|
||||
private static string GetVariableName(object variableModel)
|
||||
{
|
||||
return GetFieldOrPropertyValue(variableModel, "Name") as string;
|
||||
}
|
||||
|
||||
private static Type ResolveTypedVariableModelGenericType(IList existingVariables)
|
||||
{
|
||||
for (int i = 0; i < existingVariables.Count; i++)
|
||||
{
|
||||
object variable = existingVariables[i];
|
||||
if (variable == null)
|
||||
continue;
|
||||
|
||||
PropertyInfo nameProperty = variable.GetType().GetProperty("Name", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
FieldInfo nameField = variable.GetType().GetField("Name", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
string name = nameProperty?.GetValue(variable) as string ?? nameField?.GetValue(variable) as string;
|
||||
if (name == variableName)
|
||||
return variable;
|
||||
Type variableType = variable.GetType();
|
||||
if (variableType.IsGenericType)
|
||||
return variableType.GetGenericTypeDefinition();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static object CreateSerializableGuid(Type variableModelType)
|
||||
{
|
||||
FieldInfo idField = variableModelType.GetField("ID", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
Type guidType = idField?.FieldType;
|
||||
ConstructorInfo guidConstructor = guidType?.GetConstructor(new[] { typeof(ulong), typeof(ulong) });
|
||||
if (guidConstructor == null)
|
||||
return null;
|
||||
|
||||
byte[] guidBytes = Guid.NewGuid().ToByteArray();
|
||||
ulong value0 = BitConverter.ToUInt64(guidBytes, 0);
|
||||
ulong value1 = BitConverter.ToUInt64(guidBytes, 8);
|
||||
return guidConstructor.Invoke(new object[] { value0, value1 });
|
||||
}
|
||||
|
||||
private static object GetFieldOrPropertyValue(object target, string memberName)
|
||||
{
|
||||
if (target == null)
|
||||
return null;
|
||||
|
||||
PropertyInfo property = target.GetType().GetProperty(memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
if (property != null)
|
||||
return property.GetValue(target);
|
||||
|
||||
FieldInfo field = target.GetType().GetField(memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
return field?.GetValue(target);
|
||||
}
|
||||
|
||||
private static void SetFieldOrPropertyValue(object target, string memberName, object value)
|
||||
{
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
PropertyInfo property = target.GetType().GetProperty(memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
if (property != null && property.CanWrite)
|
||||
{
|
||||
property.SetValue(target, value);
|
||||
return;
|
||||
}
|
||||
|
||||
FieldInfo field = target.GetType().GetField(memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
field?.SetValue(target, value);
|
||||
}
|
||||
|
||||
private static void LinkTarget(object node, object targetVariable)
|
||||
{
|
||||
LinkFieldToVariable(node, "Target", typeof(GameObject), targetVariable);
|
||||
@@ -982,37 +1180,111 @@ namespace Colosseum.Editor
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 컴포넌트의 protected 필드 값을 읽습니다 (참조 타입용).
|
||||
/// 프리팹에서 BossPatternData 에셋을 로드할 때 사용합니다.
|
||||
/// BT 재빌드에 필요한 자산을 지정 경로에서 직접 로드합니다.
|
||||
/// </summary>
|
||||
private static T ReadProtectedField<T>(object obj, string fieldName) where T : class
|
||||
private static T LoadRequiredAsset<T>(string assetPath, string assetLabel) where T : UnityEngine.Object
|
||||
{
|
||||
Type type = obj.GetType();
|
||||
while (type != null)
|
||||
{
|
||||
FieldInfo field = type.GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
|
||||
if (field != null)
|
||||
return field.GetValue(obj) as T;
|
||||
type = type.BaseType;
|
||||
}
|
||||
Debug.LogError($"[DrogBTRebuild] '{fieldName}' 필드를 {obj.GetType().Name}에서 찾지 못했습니다.");
|
||||
return null;
|
||||
T asset = AssetDatabase.LoadAssetAtPath<T>(assetPath);
|
||||
if (asset == null)
|
||||
Debug.LogError($"[DrogBTRebuild] {assetLabel} 로드 실패: {assetPath}");
|
||||
|
||||
return asset;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 컴포넌트의 protected 필드 값을 읽습니다 (값 타입용).
|
||||
/// 선택 자산을 로드합니다. 없으면 null을 반환합니다.
|
||||
/// </summary>
|
||||
private static T ReadProtectedFieldValue<T>(object obj, string fieldName, T defaultValue) where T : struct
|
||||
private static T LoadOptionalAsset<T>(string assetPath) where T : UnityEngine.Object
|
||||
{
|
||||
Type type = obj.GetType();
|
||||
while (type != null)
|
||||
return AssetDatabase.LoadAssetAtPath<T>(assetPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BT 블랙보드에 필요한 변수가 없으면 기본값으로 생성하고, 있으면 기존 값을 유지합니다.
|
||||
/// </summary>
|
||||
private static object EnsureBlackboardVariable<T>(string variableName, T defaultValue)
|
||||
{
|
||||
UnityEngine.Object blackboardAsset = AssetDatabase.LoadAllAssetsAtPath(GraphAssetPath)
|
||||
.FirstOrDefault(asset => asset != null && asset.GetType().Name.Contains("BehaviorBlackboardAuthoringAsset", StringComparison.Ordinal));
|
||||
|
||||
if (blackboardAsset == null)
|
||||
{
|
||||
FieldInfo field = type.GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
|
||||
if (field != null)
|
||||
return (T)field.GetValue(obj);
|
||||
type = type.BaseType;
|
||||
Debug.LogError($"[DrogBTRebuild] 블랙보드 에셋을 찾지 못했습니다: {variableName}");
|
||||
return null;
|
||||
}
|
||||
return defaultValue;
|
||||
|
||||
IList variables = GetBlackboardVariables(blackboardAsset);
|
||||
if (variables == null)
|
||||
{
|
||||
Debug.LogError($"[DrogBTRebuild] 블랙보드 변수 목록을 읽지 못했습니다: {variableName}");
|
||||
return null;
|
||||
}
|
||||
|
||||
for (int i = 0; i < variables.Count; i++)
|
||||
{
|
||||
object variable = variables[i];
|
||||
if (variable == null || GetVariableName(variable) != variableName)
|
||||
continue;
|
||||
|
||||
return variable;
|
||||
}
|
||||
|
||||
Type typedVariableModelGeneric = ResolveTypedVariableModelGenericType(variables);
|
||||
if (typedVariableModelGeneric == null)
|
||||
{
|
||||
Debug.LogError($"[DrogBTRebuild] TypedVariableModel<> 타입을 찾지 못했습니다: {variableName}");
|
||||
return null;
|
||||
}
|
||||
|
||||
Type typedVariableModelType = typedVariableModelGeneric.MakeGenericType(typeof(T));
|
||||
object variableModel = Activator.CreateInstance(typedVariableModelType);
|
||||
if (variableModel == null)
|
||||
{
|
||||
Debug.LogError($"[DrogBTRebuild] 블랙보드 변수 생성 실패: {variableName}");
|
||||
return null;
|
||||
}
|
||||
|
||||
SetFieldOrPropertyValue(variableModel, "ID", CreateSerializableGuid(typedVariableModelType));
|
||||
SetFieldOrPropertyValue(variableModel, "Name", variableName);
|
||||
SetFieldOrPropertyValue(variableModel, "IsExposed", true);
|
||||
SetFieldOrPropertyValue(variableModel, "IsShared", false);
|
||||
SetFieldOrPropertyValue(variableModel, "m_Value", defaultValue);
|
||||
SetFieldOrPropertyValue(variableModel, "ObjectValue", defaultValue);
|
||||
|
||||
variables.Add(variableModel);
|
||||
EditorUtility.SetDirty(blackboardAsset);
|
||||
return variableModel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 현재 그래프에서 더 이상 쓰지 않는 블랙보드 변수를 제거합니다.
|
||||
/// </summary>
|
||||
private static void RemoveBlackboardVariables(params string[] variableNames)
|
||||
{
|
||||
if (variableNames == null || variableNames.Length == 0)
|
||||
return;
|
||||
|
||||
UnityEngine.Object blackboardAsset = AssetDatabase.LoadAllAssetsAtPath(GraphAssetPath)
|
||||
.FirstOrDefault(asset => asset != null && asset.GetType().Name.Contains("BehaviorBlackboardAuthoringAsset", StringComparison.Ordinal));
|
||||
|
||||
if (blackboardAsset == null)
|
||||
return;
|
||||
|
||||
IList variables = GetBlackboardVariables(blackboardAsset);
|
||||
if (variables == null)
|
||||
return;
|
||||
|
||||
HashSet<string> variableNameSet = new HashSet<string>(variableNames, StringComparer.Ordinal);
|
||||
for (int i = variables.Count - 1; i >= 0; i--)
|
||||
{
|
||||
object variable = variables[i];
|
||||
if (variable == null || !variableNameSet.Contains(GetVariableName(variable)))
|
||||
continue;
|
||||
|
||||
variables.RemoveAt(i);
|
||||
}
|
||||
|
||||
EditorUtility.SetDirty(blackboardAsset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1024,22 +1296,21 @@ namespace Colosseum.Editor
|
||||
object condModel = AttachCondition(branchNode, typeof(CheckPatternReadyCondition), authoringAssembly);
|
||||
if (condModel == null)
|
||||
{
|
||||
Debug.LogError($"[DrogBTRebuild] CheckPatternReadyCondition 부착 실패: {pattern?.PatternName}");
|
||||
Debug.LogError("[DrogBTRebuild] CheckPatternReadyCondition 부착 실패");
|
||||
return;
|
||||
}
|
||||
|
||||
// ConditionModel의 실제 타입에서 SetField<T>를 조회하여 BossPatternData 참조 설정
|
||||
MethodInfo genericSetField = condModel.GetType().GetMethods(BindingFlags.Instance | BindingFlags.NonPublic)
|
||||
.FirstOrDefault(m => m.Name == "SetField" && m.IsGenericMethod && m.GetParameters().Length == 2);
|
||||
if (genericSetField != null)
|
||||
{
|
||||
MethodInfo closedMethod = genericSetField.MakeGenericMethod(typeof(BossPatternData));
|
||||
closedMethod.Invoke(condModel, new object[] { "Pattern", pattern });
|
||||
}
|
||||
else
|
||||
.FirstOrDefault(method => method.Name == "SetField" && method.IsGenericMethod && method.GetParameters().Length == 2);
|
||||
|
||||
if (genericSetField == null)
|
||||
{
|
||||
Debug.LogError("[DrogBTRebuild] CheckPatternReadyCondition에서 SetField<T>를 찾지 못했습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
MethodInfo closedMethod = genericSetField.MakeGenericMethod(typeof(BossPatternData));
|
||||
closedMethod.Invoke(condModel, new object[] { "Pattern", pattern });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1053,5 +1324,6 @@ namespace Colosseum.Editor
|
||||
|
||||
AttachConditionWithValue(branchNode, typeof(IsMinPhaseSatisfiedCondition), "MinPhase", pattern.MinPhase, authoringAssembly);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
923
Assets/_Game/Scripts/Editor/RebuildDrogCombatAssets.cs
Normal file
923
Assets/_Game/Scripts/Editor/RebuildDrogCombatAssets.cs
Normal file
@@ -0,0 +1,923 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
using Colosseum.Abnormalities;
|
||||
using Colosseum.AI;
|
||||
using Colosseum.Skills;
|
||||
using Colosseum.Skills.Effects;
|
||||
|
||||
namespace Colosseum.Editor
|
||||
{
|
||||
/// <summary>
|
||||
/// 드로그 기획/패턴 문서를 기준으로 스킬/이펙트/패턴 플레이스홀더 자산을 재구성합니다.
|
||||
/// 애니메이션이 아직 확정되지 않은 단계에서도 BT와 데이터 연결을 먼저 맞추는 용도입니다.
|
||||
/// </summary>
|
||||
public static class RebuildDrogCombatAssets
|
||||
{
|
||||
private const string AnimationsFolder = "Assets/_Game/Animations";
|
||||
private const string SkillsFolder = "Assets/_Game/Data/Skills";
|
||||
private const string PatternsFolder = "Assets/_Game/Data/Patterns";
|
||||
private const string EffectsFolder = "Assets/_Game/Data/Skills/Effects";
|
||||
private const string ExecutionTelegraphAbnormalityPath = "Assets/_Game/Data/Abnormalities/Data_Abnormality_Drog_집행준비.asset";
|
||||
|
||||
[MenuItem("Tools/Colosseum/Rebuild Drog Combat Assets")]
|
||||
private static void Rebuild()
|
||||
{
|
||||
try
|
||||
{
|
||||
EnsureFolder("Assets/_Game");
|
||||
EnsureFolder("Assets/_Game/Animations");
|
||||
EnsureFolder("Assets/_Game/Data");
|
||||
EnsureFolder("Assets/_Game/Data/Skills");
|
||||
EnsureFolder("Assets/_Game/Data/Patterns");
|
||||
EnsureFolder("Assets/_Game/Data/Skills/Effects");
|
||||
|
||||
AbnormalityData executionTelegraph = AssetDatabase.LoadAssetAtPath<AbnormalityData>(ExecutionTelegraphAbnormalityPath);
|
||||
if (executionTelegraph == null)
|
||||
{
|
||||
Debug.LogError($"[DrogCombatAssets] 집행 전조 이상상태를 찾을 수 없습니다: {ExecutionTelegraphAbnormalityPath}");
|
||||
return;
|
||||
}
|
||||
|
||||
AnimationClip combo1Clip = EnsurePlaceholderClip($"{AnimationsFolder}/Anim_Drog_연타1_0.anim");
|
||||
AnimationClip combo2Clip = EnsurePlaceholderClip($"{AnimationsFolder}/Anim_Drog_연타2_0.anim");
|
||||
AnimationClip slamClip = EnsurePlaceholderClip($"{AnimationsFolder}/Anim_Drog_강타_0.anim");
|
||||
AnimationClip combo3Clip = EnsurePlaceholderClip($"{AnimationsFolder}/Anim_Drog_연타3_0.anim");
|
||||
AnimationClip combo4Clip = EnsurePlaceholderClip($"{AnimationsFolder}/Anim_Drog_연타4_0.anim");
|
||||
AnimationClip stompClip = EnsurePlaceholderClip($"{AnimationsFolder}/Anim_Drog_발구르기_0.anim");
|
||||
AnimationClip leapPrepareClip = EnsurePlaceholderClip($"{AnimationsFolder}/Anim_Drog_도약_준비_0.anim");
|
||||
AnimationClip leapAirClip = EnsurePlaceholderClip($"{AnimationsFolder}/Anim_Drog_도약_공중_0.anim");
|
||||
AnimationClip leapLandingClip = EnsurePlaceholderClip($"{AnimationsFolder}/Anim_Drog_도약_착지_0.anim");
|
||||
AnimationClip stepClip = EnsurePlaceholderClip($"{AnimationsFolder}/Anim_Drog_밟기_0.anim");
|
||||
AnimationClip throwClip = EnsurePlaceholderClip($"{AnimationsFolder}/Anim_Drog_투척_0.anim");
|
||||
AnimationClip roarClip = EnsurePlaceholderClip($"{AnimationsFolder}/Anim_Drog_포효_0.anim");
|
||||
AnimationClip executionReadyClip = EnsurePlaceholderClip($"{AnimationsFolder}/Anim_Drog_집행_준비_0.anim");
|
||||
AnimationClip executionHit1Clip = EnsurePlaceholderClip($"{AnimationsFolder}/Anim_Drog_집행_연타1_0.anim");
|
||||
AnimationClip executionHit2Clip = EnsurePlaceholderClip($"{AnimationsFolder}/Anim_Drog_집행_연타2_0.anim");
|
||||
AnimationClip executionHit3Clip = EnsurePlaceholderClip($"{AnimationsFolder}/Anim_Drog_집행_연타3_0.anim");
|
||||
|
||||
DamageEffect combo1Damage = CreateDamageEffect(
|
||||
$"{EffectsFolder}/Data_SkillEffect_Drog_연타1_0_데미지.asset",
|
||||
24f,
|
||||
DamageType.Physical,
|
||||
0.75f,
|
||||
AreaShapeType.Fan,
|
||||
3.25f,
|
||||
1.25f,
|
||||
3.25f,
|
||||
42f,
|
||||
AreaCenterType.Caster);
|
||||
|
||||
DamageEffect combo2Damage = CreateDamageEffect(
|
||||
$"{EffectsFolder}/Data_SkillEffect_Drog_연타2_0_데미지.asset",
|
||||
30f,
|
||||
DamageType.Physical,
|
||||
0.9f,
|
||||
AreaShapeType.Fan,
|
||||
3.5f,
|
||||
1.35f,
|
||||
3.5f,
|
||||
46f,
|
||||
AreaCenterType.Caster);
|
||||
|
||||
DamageEffect slamDamage = CreateDamageEffect(
|
||||
$"{EffectsFolder}/Data_SkillEffect_Drog_강타_0_데미지.asset",
|
||||
48f,
|
||||
DamageType.Physical,
|
||||
1.15f,
|
||||
AreaShapeType.Fan,
|
||||
3.4f,
|
||||
1.2f,
|
||||
3.4f,
|
||||
32f,
|
||||
AreaCenterType.Caster);
|
||||
|
||||
DownEffect slamDown = CreateDownEffect(
|
||||
$"{EffectsFolder}/Data_SkillEffect_Drog_강타_1_다운.asset",
|
||||
1.8f,
|
||||
AreaShapeType.Fan,
|
||||
3.4f,
|
||||
1.2f,
|
||||
3.4f,
|
||||
32f,
|
||||
AreaCenterType.Caster);
|
||||
|
||||
DamageEffect combo3Damage = CreateDamageEffect(
|
||||
$"{EffectsFolder}/Data_SkillEffect_Drog_연타3_0_데미지.asset",
|
||||
26f,
|
||||
DamageType.Physical,
|
||||
0.8f,
|
||||
AreaShapeType.Fan,
|
||||
3.6f,
|
||||
1.3f,
|
||||
3.6f,
|
||||
55f,
|
||||
AreaCenterType.Caster);
|
||||
|
||||
DamageEffect combo4Damage = CreateDamageEffect(
|
||||
$"{EffectsFolder}/Data_SkillEffect_Drog_연타4_0_데미지.asset",
|
||||
28f,
|
||||
DamageType.Physical,
|
||||
0.85f,
|
||||
AreaShapeType.Fan,
|
||||
3.8f,
|
||||
1.35f,
|
||||
3.8f,
|
||||
58f,
|
||||
AreaCenterType.Caster);
|
||||
|
||||
DamageEffect stompDamage = CreateDamageEffect(
|
||||
$"{EffectsFolder}/Data_SkillEffect_Drog_발구르기_0_데미지.asset",
|
||||
22f,
|
||||
DamageType.Physical,
|
||||
0.65f,
|
||||
AreaShapeType.Sphere,
|
||||
4.75f,
|
||||
1f,
|
||||
4.75f,
|
||||
180f,
|
||||
AreaCenterType.Caster);
|
||||
|
||||
KnockbackEffect stompKnockback = CreateKnockbackEffect(
|
||||
$"{EffectsFolder}/Data_SkillEffect_Drog_발구르기_1_넉백.asset",
|
||||
6f,
|
||||
1.5f,
|
||||
0.2f,
|
||||
AreaShapeType.Sphere,
|
||||
4.75f,
|
||||
1f,
|
||||
4.75f,
|
||||
180f,
|
||||
AreaCenterType.Caster);
|
||||
|
||||
DamageEffect leapLandingDamage = CreateDamageEffect(
|
||||
$"{EffectsFolder}/Data_SkillEffect_Drog_도약_착지_0_데미지.asset",
|
||||
34f,
|
||||
DamageType.Physical,
|
||||
0.95f,
|
||||
AreaShapeType.Sphere,
|
||||
4.2f,
|
||||
1f,
|
||||
4.2f,
|
||||
180f,
|
||||
AreaCenterType.Caster);
|
||||
|
||||
KnockbackEffect leapLandingKnockback = CreateKnockbackEffect(
|
||||
$"{EffectsFolder}/Data_SkillEffect_Drog_도약_착지_1_넉백.asset",
|
||||
8f,
|
||||
2f,
|
||||
0.25f,
|
||||
AreaShapeType.Sphere,
|
||||
4.2f,
|
||||
1f,
|
||||
4.2f,
|
||||
180f,
|
||||
AreaCenterType.Caster);
|
||||
|
||||
HitReactionDamageEffect stepDamage = CreateHitReactionDamageEffect(
|
||||
$"{EffectsFolder}/Data_SkillEffect_Drog_밟기_0_피격가중데미지.asset",
|
||||
52f,
|
||||
DamageType.Physical,
|
||||
1.1f,
|
||||
1.6f,
|
||||
AreaShapeType.Sphere,
|
||||
2.8f,
|
||||
1f,
|
||||
2.8f,
|
||||
180f,
|
||||
AreaCenterType.Caster);
|
||||
|
||||
KnockbackEffect stepKnockback = CreateKnockbackEffect(
|
||||
$"{EffectsFolder}/Data_SkillEffect_Drog_밟기_1_넉백.asset",
|
||||
5f,
|
||||
1f,
|
||||
0.18f,
|
||||
AreaShapeType.Sphere,
|
||||
2.8f,
|
||||
1f,
|
||||
2.8f,
|
||||
180f,
|
||||
AreaCenterType.Caster);
|
||||
|
||||
DamageEffect throwDamage = CreateDamageEffect(
|
||||
$"{EffectsFolder}/Data_SkillEffect_Drog_투척_0_데미지.asset",
|
||||
28f,
|
||||
DamageType.Physical,
|
||||
0.7f,
|
||||
AreaShapeType.Beam,
|
||||
12f,
|
||||
1.2f,
|
||||
0.75f,
|
||||
0f,
|
||||
AreaCenterType.Caster);
|
||||
|
||||
DamageEffect executionHit1 = CreateDamageEffect(
|
||||
$"{EffectsFolder}/Data_SkillEffect_Drog_집행_연타1_0_데미지.asset",
|
||||
14f,
|
||||
DamageType.Physical,
|
||||
0.35f,
|
||||
AreaShapeType.Sphere,
|
||||
8.5f,
|
||||
1f,
|
||||
8.5f,
|
||||
180f,
|
||||
AreaCenterType.Caster);
|
||||
|
||||
DamageEffect executionHit2 = CreateDamageEffect(
|
||||
$"{EffectsFolder}/Data_SkillEffect_Drog_집행_연타2_0_데미지.asset",
|
||||
17f,
|
||||
DamageType.Physical,
|
||||
0.4f,
|
||||
AreaShapeType.Sphere,
|
||||
8.5f,
|
||||
1f,
|
||||
8.5f,
|
||||
180f,
|
||||
AreaCenterType.Caster);
|
||||
|
||||
DamageEffect executionHit3 = CreateDamageEffect(
|
||||
$"{EffectsFolder}/Data_SkillEffect_Drog_집행_연타3_0_데미지.asset",
|
||||
20f,
|
||||
DamageType.Physical,
|
||||
0.45f,
|
||||
AreaShapeType.Sphere,
|
||||
8.5f,
|
||||
1f,
|
||||
8.5f,
|
||||
180f,
|
||||
AreaCenterType.Caster);
|
||||
|
||||
SkillData combo1Skill = CreateSkill(
|
||||
$"{SkillsFolder}/Data_Skill_Drog_연타1.asset",
|
||||
"연타1",
|
||||
"기본 루프의 첫 타격입니다.",
|
||||
combo1Clip,
|
||||
1f,
|
||||
SkillCastTargetTrackingMode.FaceTarget,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
combo1Damage);
|
||||
|
||||
SkillData combo2Skill = CreateSkill(
|
||||
$"{SkillsFolder}/Data_Skill_Drog_연타2.asset",
|
||||
"연타2",
|
||||
"기본 루프의 두 번째 타격입니다.",
|
||||
combo2Clip,
|
||||
1f,
|
||||
SkillCastTargetTrackingMode.FaceTarget,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
combo2Damage);
|
||||
|
||||
SkillData slamSkill = CreateSkill(
|
||||
$"{SkillsFolder}/Data_Skill_Drog_강타.asset",
|
||||
"강타",
|
||||
"정면 관리 실패를 응징하는 강한 일격입니다.",
|
||||
slamClip,
|
||||
1f,
|
||||
SkillCastTargetTrackingMode.FaceTarget,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
slamDamage,
|
||||
slamDown);
|
||||
|
||||
SkillData combo3Skill = CreateSkill(
|
||||
$"{SkillsFolder}/Data_Skill_Drog_연타3.asset",
|
||||
"연타3",
|
||||
"강타로 이어지는 선행 타격입니다.",
|
||||
combo3Clip,
|
||||
1f,
|
||||
SkillCastTargetTrackingMode.FaceTarget,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
combo3Damage);
|
||||
|
||||
SkillData combo4Skill = CreateSkill(
|
||||
$"{SkillsFolder}/Data_Skill_Drog_연타4.asset",
|
||||
"연타4",
|
||||
"발구르기로 이어지는 압박용 선행 타격입니다.",
|
||||
combo4Clip,
|
||||
1f,
|
||||
SkillCastTargetTrackingMode.FaceTarget,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
combo4Damage);
|
||||
|
||||
SkillData stompSkill = CreateSkill(
|
||||
$"{SkillsFolder}/Data_Skill_Drog_발구르기.asset",
|
||||
"발구르기",
|
||||
"근접 측후방 전체를 흔드는 광역 압박입니다.",
|
||||
stompClip,
|
||||
1f,
|
||||
SkillCastTargetTrackingMode.None,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
stompDamage,
|
||||
stompKnockback);
|
||||
|
||||
SkillData leapPrepareSkill = CreateSkill(
|
||||
$"{SkillsFolder}/Data_Skill_Drog_도약_준비.asset",
|
||||
"도약 준비",
|
||||
"원거리 이탈 대상에게 시선을 고정합니다.",
|
||||
leapPrepareClip,
|
||||
1f,
|
||||
SkillCastTargetTrackingMode.FaceTarget,
|
||||
false,
|
||||
true,
|
||||
false);
|
||||
|
||||
SkillData leapAirSkill = CreateSkill(
|
||||
$"{SkillsFolder}/Data_Skill_Drog_도약_공중.asset",
|
||||
"도약 공중",
|
||||
"대상 위치로 도약하는 이동 스텝입니다.",
|
||||
leapAirClip,
|
||||
1f,
|
||||
SkillCastTargetTrackingMode.MoveTowardTarget,
|
||||
true,
|
||||
false,
|
||||
true);
|
||||
|
||||
SkillData leapLandingSkill = CreateSkill(
|
||||
$"{SkillsFolder}/Data_Skill_Drog_도약_착지.asset",
|
||||
"도약 착지",
|
||||
"도약 종료 시 주변에 피해와 넉백을 줍니다.",
|
||||
leapLandingClip,
|
||||
1f,
|
||||
SkillCastTargetTrackingMode.None,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
leapLandingDamage,
|
||||
leapLandingKnockback);
|
||||
|
||||
SkillData stepSkill = CreateSkill(
|
||||
$"{SkillsFolder}/Data_Skill_Drog_밟기.asset",
|
||||
"밟기",
|
||||
"다운된 대상을 후속 압박으로 처벌합니다.",
|
||||
stepClip,
|
||||
1f,
|
||||
SkillCastTargetTrackingMode.FaceTarget,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
stepDamage,
|
||||
stepKnockback);
|
||||
|
||||
SkillData throwSkill = CreateSkill(
|
||||
$"{SkillsFolder}/Data_Skill_Drog_투척.asset",
|
||||
"투척",
|
||||
"부활 시전자나 원거리 대상을 견제하는 유틸리티 공격입니다.",
|
||||
throwClip,
|
||||
1f,
|
||||
SkillCastTargetTrackingMode.FaceTarget,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
throwDamage);
|
||||
|
||||
SkillData roarSkill = CreateSkill(
|
||||
$"{SkillsFolder}/Data_Skill_Drog_포효.asset",
|
||||
"포효",
|
||||
"Phase 3 진입을 알리는 전환 신호입니다.",
|
||||
roarClip,
|
||||
0.9f,
|
||||
SkillCastTargetTrackingMode.None,
|
||||
false,
|
||||
true,
|
||||
false);
|
||||
|
||||
SkillData executionReadySkill = CreateSkill(
|
||||
$"{SkillsFolder}/Data_Skill_Drog_집행_준비.asset",
|
||||
"집행 준비",
|
||||
"집행 돌입 전 자세를 고정합니다.",
|
||||
executionReadyClip,
|
||||
0.85f,
|
||||
SkillCastTargetTrackingMode.None,
|
||||
false,
|
||||
true,
|
||||
false);
|
||||
|
||||
SkillData executionHit1Skill = CreateSkill(
|
||||
$"{SkillsFolder}/Data_Skill_Drog_집행_연타1.asset",
|
||||
"집행 연타1",
|
||||
"집행의 첫 압박 타격입니다.",
|
||||
executionHit1Clip,
|
||||
1f,
|
||||
SkillCastTargetTrackingMode.None,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
executionHit1);
|
||||
|
||||
SkillData executionHit2Skill = CreateSkill(
|
||||
$"{SkillsFolder}/Data_Skill_Drog_집행_연타2.asset",
|
||||
"집행 연타2",
|
||||
"집행의 두 번째 압박 타격입니다.",
|
||||
executionHit2Clip,
|
||||
1.1f,
|
||||
SkillCastTargetTrackingMode.None,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
executionHit2);
|
||||
|
||||
SkillData executionHit3Skill = CreateSkill(
|
||||
$"{SkillsFolder}/Data_Skill_Drog_집행_연타3.asset",
|
||||
"집행 연타3",
|
||||
"집행의 세 번째 압박 타격입니다.",
|
||||
executionHit3Clip,
|
||||
1.2f,
|
||||
SkillCastTargetTrackingMode.None,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
executionHit3);
|
||||
|
||||
CreatePattern(
|
||||
$"{PatternsFolder}/Data_Pattern_Drog_연타1.asset",
|
||||
"연타1",
|
||||
PatternCategory.Basic,
|
||||
false,
|
||||
true,
|
||||
TargetResolveMode.HighestThreat,
|
||||
2.5f,
|
||||
1,
|
||||
false,
|
||||
PatternStepDefinition.CreateSkillStep(combo1Skill));
|
||||
|
||||
CreatePattern(
|
||||
$"{PatternsFolder}/Data_Pattern_Drog_연타2.asset",
|
||||
"연타2",
|
||||
PatternCategory.Basic,
|
||||
false,
|
||||
true,
|
||||
TargetResolveMode.HighestThreat,
|
||||
2.75f,
|
||||
1,
|
||||
false,
|
||||
PatternStepDefinition.CreateSkillStep(combo2Skill));
|
||||
|
||||
CreatePattern(
|
||||
$"{PatternsFolder}/Data_Pattern_Drog_연타3-강타.asset",
|
||||
"연타3-강타",
|
||||
PatternCategory.Basic,
|
||||
false,
|
||||
true,
|
||||
TargetResolveMode.HighestThreat,
|
||||
4.5f,
|
||||
1,
|
||||
false,
|
||||
PatternStepDefinition.CreateSkillStep(combo3Skill),
|
||||
PatternStepDefinition.CreateWaitStep(0.15f),
|
||||
PatternStepDefinition.CreateSkillStep(slamSkill));
|
||||
|
||||
CreatePattern(
|
||||
$"{PatternsFolder}/Data_Pattern_Drog_연타4-발구르기.asset",
|
||||
"연타4-발구르기",
|
||||
PatternCategory.Basic,
|
||||
false,
|
||||
true,
|
||||
TargetResolveMode.HighestThreat,
|
||||
5f,
|
||||
1,
|
||||
false,
|
||||
PatternStepDefinition.CreateSkillStep(combo4Skill),
|
||||
PatternStepDefinition.CreateWaitStep(0.15f),
|
||||
PatternStepDefinition.CreateSkillStep(stompSkill));
|
||||
|
||||
CreatePattern(
|
||||
$"{PatternsFolder}/Data_Pattern_Drog_밟기.asset",
|
||||
"밟기",
|
||||
PatternCategory.Punish,
|
||||
false,
|
||||
false,
|
||||
TargetResolveMode.HighestThreat,
|
||||
2.5f,
|
||||
2,
|
||||
false,
|
||||
PatternStepDefinition.CreateSkillStep(stepSkill));
|
||||
|
||||
CreatePattern(
|
||||
$"{PatternsFolder}/Data_Pattern_Drog_도약.asset",
|
||||
"도약",
|
||||
PatternCategory.Big,
|
||||
false,
|
||||
false,
|
||||
TargetResolveMode.Mobility,
|
||||
8f,
|
||||
2,
|
||||
false,
|
||||
PatternStepDefinition.CreateSkillStep(leapPrepareSkill),
|
||||
PatternStepDefinition.CreateWaitStep(0.1f),
|
||||
PatternStepDefinition.CreateSkillStep(leapAirSkill),
|
||||
PatternStepDefinition.CreateWaitStep(0.1f),
|
||||
PatternStepDefinition.CreateSkillStep(leapLandingSkill));
|
||||
|
||||
CreatePattern(
|
||||
$"{PatternsFolder}/Data_Pattern_Drog_투척.asset",
|
||||
"투척",
|
||||
PatternCategory.Basic,
|
||||
false,
|
||||
false,
|
||||
TargetResolveMode.Utility,
|
||||
10f,
|
||||
2,
|
||||
false,
|
||||
PatternStepDefinition.CreateSkillStep(throwSkill));
|
||||
|
||||
CreatePattern(
|
||||
$"{PatternsFolder}/Data_Pattern_Drog_집행.asset",
|
||||
"집행",
|
||||
PatternCategory.Big,
|
||||
true,
|
||||
false,
|
||||
TargetResolveMode.HighestThreat,
|
||||
45f,
|
||||
3,
|
||||
false,
|
||||
PatternStepDefinition.CreateSkillStep(executionReadySkill),
|
||||
PatternStepDefinition.CreateChargeWaitStep(2.25f, executionTelegraph, 0.1f, 2f),
|
||||
PatternStepDefinition.CreateSkillStep(executionHit1Skill),
|
||||
PatternStepDefinition.CreateWaitStep(0.65f),
|
||||
PatternStepDefinition.CreateSkillStep(executionHit2Skill),
|
||||
PatternStepDefinition.CreateWaitStep(0.45f),
|
||||
PatternStepDefinition.CreateSkillStep(executionHit3Skill));
|
||||
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
Debug.Log("[DrogCombatAssets] 드로그 스킬/이펙트/패턴 플레이스홀더 자산 재구성이 완료되었습니다.");
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Debug.LogException(exception);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 폴더가 없으면 생성합니다.
|
||||
/// </summary>
|
||||
private static void EnsureFolder(string path)
|
||||
{
|
||||
if (AssetDatabase.IsValidFolder(path))
|
||||
return;
|
||||
|
||||
string parent = Path.GetDirectoryName(path)?.Replace('\\', '/');
|
||||
if (string.IsNullOrEmpty(parent))
|
||||
return;
|
||||
|
||||
EnsureFolder(parent);
|
||||
AssetDatabase.CreateFolder(parent, Path.GetFileName(path));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 지정 경로의 ScriptableObject를 읽거나 새로 생성합니다.
|
||||
/// </summary>
|
||||
private static T LoadOrCreateAsset<T>(string path) where T : ScriptableObject
|
||||
{
|
||||
T asset = AssetDatabase.LoadAssetAtPath<T>(path);
|
||||
if (asset != null)
|
||||
return asset;
|
||||
|
||||
asset = ScriptableObject.CreateInstance<T>();
|
||||
asset.name = Path.GetFileNameWithoutExtension(path);
|
||||
AssetDatabase.CreateAsset(asset, path);
|
||||
return asset;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 드로그 스킬 플레이스홀더용 빈 애니메이션 클립을 보장합니다.
|
||||
/// </summary>
|
||||
private static AnimationClip EnsurePlaceholderClip(string path)
|
||||
{
|
||||
AnimationClip clip = AssetDatabase.LoadAssetAtPath<AnimationClip>(path);
|
||||
if (clip != null)
|
||||
return clip;
|
||||
|
||||
clip = new AnimationClip
|
||||
{
|
||||
name = Path.GetFileNameWithoutExtension(path),
|
||||
frameRate = 60f,
|
||||
};
|
||||
|
||||
AssetDatabase.CreateAsset(clip, path);
|
||||
return clip;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effect/Skill/Pattern의 공통 Object 리스트를 설정합니다.
|
||||
/// </summary>
|
||||
private static void SetObjectList(SerializedObject serializedObject, string propertyName, IReadOnlyList<UnityEngine.Object> values)
|
||||
{
|
||||
SerializedProperty listProperty = serializedObject.FindProperty(propertyName);
|
||||
listProperty.arraySize = values != null ? values.Count : 0;
|
||||
|
||||
for (int i = 0; i < listProperty.arraySize; i++)
|
||||
{
|
||||
listProperty.GetArrayElementAtIndex(i).objectReferenceValue = values[i];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 범위형 효과의 공통 판정 설정을 적용합니다.
|
||||
/// </summary>
|
||||
private static void ConfigureAreaEffect(
|
||||
SerializedObject serializedObject,
|
||||
AreaShapeType areaShape,
|
||||
float areaRadius,
|
||||
float fanOriginDistance,
|
||||
float fanRadius,
|
||||
float fanHalfAngle,
|
||||
AreaCenterType areaCenter)
|
||||
{
|
||||
serializedObject.FindProperty("targetType").enumValueIndex = (int)TargetType.Area;
|
||||
serializedObject.FindProperty("targetTeam").enumValueIndex = (int)TargetTeam.Enemy;
|
||||
serializedObject.FindProperty("areaCenter").enumValueIndex = (int)areaCenter;
|
||||
serializedObject.FindProperty("areaShape").enumValueIndex = (int)areaShape;
|
||||
serializedObject.FindProperty("includeCasterInArea").boolValue = false;
|
||||
serializedObject.FindProperty("areaRadius").floatValue = areaRadius;
|
||||
serializedObject.FindProperty("fanOriginDistance").floatValue = fanOriginDistance;
|
||||
serializedObject.FindProperty("fanRadius").floatValue = fanRadius;
|
||||
serializedObject.FindProperty("fanHalfAngle").floatValue = fanHalfAngle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 범위 피해 효과를 생성하거나 갱신합니다.
|
||||
/// </summary>
|
||||
private static DamageEffect CreateDamageEffect(
|
||||
string path,
|
||||
float baseDamage,
|
||||
DamageType damageType,
|
||||
float statScaling,
|
||||
AreaShapeType areaShape,
|
||||
float areaRadius,
|
||||
float fanOriginDistance,
|
||||
float fanRadius,
|
||||
float fanHalfAngle,
|
||||
AreaCenterType areaCenter)
|
||||
{
|
||||
DamageEffect effect = LoadOrCreateAsset<DamageEffect>(path);
|
||||
SerializedObject serializedObject = new SerializedObject(effect);
|
||||
|
||||
ConfigureAreaEffect(serializedObject, areaShape, areaRadius, fanOriginDistance, fanRadius, fanHalfAngle, areaCenter);
|
||||
serializedObject.FindProperty("baseDamage").floatValue = baseDamage;
|
||||
serializedObject.FindProperty("damageType").enumValueIndex = (int)damageType;
|
||||
serializedObject.FindProperty("statScaling").floatValue = statScaling;
|
||||
serializedObject.ApplyModifiedPropertiesWithoutUndo();
|
||||
|
||||
EditorUtility.SetDirty(effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 범위 다운 효과를 생성하거나 갱신합니다.
|
||||
/// </summary>
|
||||
private static DownEffect CreateDownEffect(
|
||||
string path,
|
||||
float duration,
|
||||
AreaShapeType areaShape,
|
||||
float areaRadius,
|
||||
float fanOriginDistance,
|
||||
float fanRadius,
|
||||
float fanHalfAngle,
|
||||
AreaCenterType areaCenter)
|
||||
{
|
||||
DownEffect effect = LoadOrCreateAsset<DownEffect>(path);
|
||||
SerializedObject serializedObject = new SerializedObject(effect);
|
||||
|
||||
ConfigureAreaEffect(serializedObject, areaShape, areaRadius, fanOriginDistance, fanRadius, fanHalfAngle, areaCenter);
|
||||
serializedObject.FindProperty("duration").floatValue = duration;
|
||||
serializedObject.ApplyModifiedPropertiesWithoutUndo();
|
||||
|
||||
EditorUtility.SetDirty(effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 범위 넉백 효과를 생성하거나 갱신합니다.
|
||||
/// </summary>
|
||||
private static KnockbackEffect CreateKnockbackEffect(
|
||||
string path,
|
||||
float force,
|
||||
float upwardForce,
|
||||
float duration,
|
||||
AreaShapeType areaShape,
|
||||
float areaRadius,
|
||||
float fanOriginDistance,
|
||||
float fanRadius,
|
||||
float fanHalfAngle,
|
||||
AreaCenterType areaCenter)
|
||||
{
|
||||
KnockbackEffect effect = LoadOrCreateAsset<KnockbackEffect>(path);
|
||||
SerializedObject serializedObject = new SerializedObject(effect);
|
||||
|
||||
ConfigureAreaEffect(serializedObject, areaShape, areaRadius, fanOriginDistance, fanRadius, fanHalfAngle, areaCenter);
|
||||
serializedObject.FindProperty("force").floatValue = force;
|
||||
serializedObject.FindProperty("upwardForce").floatValue = upwardForce;
|
||||
serializedObject.FindProperty("duration").floatValue = duration;
|
||||
serializedObject.ApplyModifiedPropertiesWithoutUndo();
|
||||
|
||||
EditorUtility.SetDirty(effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 다운 대상 추가 피해 효과를 생성하거나 갱신합니다.
|
||||
/// </summary>
|
||||
private static HitReactionDamageEffect CreateHitReactionDamageEffect(
|
||||
string path,
|
||||
float baseDamage,
|
||||
DamageType damageType,
|
||||
float statScaling,
|
||||
float downedDamageMultiplier,
|
||||
AreaShapeType areaShape,
|
||||
float areaRadius,
|
||||
float fanOriginDistance,
|
||||
float fanRadius,
|
||||
float fanHalfAngle,
|
||||
AreaCenterType areaCenter)
|
||||
{
|
||||
HitReactionDamageEffect effect = LoadOrCreateAsset<HitReactionDamageEffect>(path);
|
||||
SerializedObject serializedObject = new SerializedObject(effect);
|
||||
|
||||
ConfigureAreaEffect(serializedObject, areaShape, areaRadius, fanOriginDistance, fanRadius, fanHalfAngle, areaCenter);
|
||||
serializedObject.FindProperty("baseDamage").floatValue = baseDamage;
|
||||
serializedObject.FindProperty("damageType").enumValueIndex = (int)damageType;
|
||||
serializedObject.FindProperty("statScaling").floatValue = statScaling;
|
||||
serializedObject.FindProperty("bonusAgainstDownedTarget").boolValue = true;
|
||||
serializedObject.FindProperty("downedDamageMultiplier").floatValue = downedDamageMultiplier;
|
||||
serializedObject.ApplyModifiedPropertiesWithoutUndo();
|
||||
|
||||
EditorUtility.SetDirty(effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 빈 애니메이션 상태에서도 즉시 발동 가능한 드로그 스킬 플레이스홀더를 생성하거나 갱신합니다.
|
||||
/// </summary>
|
||||
private static SkillData CreateSkill(
|
||||
string path,
|
||||
string skillName,
|
||||
string description,
|
||||
AnimationClip clip,
|
||||
float animationSpeed,
|
||||
SkillCastTargetTrackingMode trackingMode,
|
||||
bool useRootMotion,
|
||||
bool ignoreRootMotionY,
|
||||
bool jumpToTarget,
|
||||
params SkillEffect[] castStartEffects)
|
||||
{
|
||||
SkillData skill = LoadOrCreateAsset<SkillData>(path);
|
||||
SerializedObject serializedObject = new SerializedObject(skill);
|
||||
|
||||
serializedObject.FindProperty("skillName").stringValue = skillName;
|
||||
serializedObject.FindProperty("description").stringValue = description;
|
||||
serializedObject.FindProperty("skillRole").enumValueIndex = (int)SkillRoleType.Attack;
|
||||
serializedObject.FindProperty("activationType").enumValueIndex = (int)SkillActivationType.Instant;
|
||||
serializedObject.FindProperty("baseTypes").intValue = (int)SkillBaseType.Attack;
|
||||
serializedObject.FindProperty("animationSpeed").floatValue = animationSpeed;
|
||||
serializedObject.FindProperty("useRootMotion").boolValue = useRootMotion;
|
||||
serializedObject.FindProperty("ignoreRootMotionY").boolValue = ignoreRootMotionY;
|
||||
serializedObject.FindProperty("jumpToTarget").boolValue = jumpToTarget;
|
||||
serializedObject.FindProperty("blockMovementWhileCasting").boolValue = true;
|
||||
serializedObject.FindProperty("blockJumpWhileCasting").boolValue = true;
|
||||
serializedObject.FindProperty("blockOtherSkillsWhileCasting").boolValue = true;
|
||||
serializedObject.FindProperty("castTargetTrackingMode").enumValueIndex = (int)trackingMode;
|
||||
serializedObject.FindProperty("castTargetRotationSpeed").floatValue = 12f;
|
||||
serializedObject.FindProperty("castTargetStopDistance").floatValue = 2.5f;
|
||||
serializedObject.FindProperty("cooldown").floatValue = 0f;
|
||||
serializedObject.FindProperty("manaCost").floatValue = 0f;
|
||||
serializedObject.FindProperty("maxGemSlotCount").intValue = 0;
|
||||
serializedObject.FindProperty("triggeredEffects").arraySize = 0;
|
||||
|
||||
SetObjectList(serializedObject, "animationClips", new UnityEngine.Object[] { clip });
|
||||
|
||||
var effectObjects = new List<UnityEngine.Object>();
|
||||
if (castStartEffects != null)
|
||||
{
|
||||
for (int i = 0; i < castStartEffects.Length; i++)
|
||||
{
|
||||
if (castStartEffects[i] != null)
|
||||
effectObjects.Add(castStartEffects[i]);
|
||||
}
|
||||
}
|
||||
|
||||
SetObjectList(serializedObject, "castStartEffects", effectObjects);
|
||||
serializedObject.ApplyModifiedPropertiesWithoutUndo();
|
||||
|
||||
EditorUtility.SetDirty(skill);
|
||||
return skill;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 드로그 보스 패턴 자산을 생성하거나 갱신합니다.
|
||||
/// </summary>
|
||||
private static BossPatternData CreatePattern(
|
||||
string path,
|
||||
string patternName,
|
||||
PatternCategory category,
|
||||
bool isSignature,
|
||||
bool isMelee,
|
||||
TargetResolveMode targetMode,
|
||||
float cooldown,
|
||||
int minPhase,
|
||||
bool skipJumpStepOnNoTarget,
|
||||
params PatternStepDefinition[] stepDefinitions)
|
||||
{
|
||||
BossPatternData pattern = LoadOrCreateAsset<BossPatternData>(path);
|
||||
SerializedObject serializedObject = new SerializedObject(pattern);
|
||||
|
||||
serializedObject.FindProperty("patternName").stringValue = patternName;
|
||||
serializedObject.FindProperty("category").enumValueIndex = (int)category;
|
||||
serializedObject.FindProperty("isSignature").boolValue = isSignature;
|
||||
serializedObject.FindProperty("isMelee").boolValue = isMelee;
|
||||
serializedObject.FindProperty("targetMode").enumValueIndex = (int)targetMode;
|
||||
serializedObject.FindProperty("cooldown").floatValue = cooldown;
|
||||
serializedObject.FindProperty("minPhase").intValue = minPhase;
|
||||
serializedObject.FindProperty("skipJumpStepOnNoTarget").boolValue = skipJumpStepOnNoTarget;
|
||||
|
||||
SerializedProperty stepsProperty = serializedObject.FindProperty("steps");
|
||||
stepsProperty.arraySize = stepDefinitions != null ? stepDefinitions.Length : 0;
|
||||
|
||||
for (int i = 0; i < stepsProperty.arraySize; i++)
|
||||
{
|
||||
ConfigurePatternStep(stepsProperty.GetArrayElementAtIndex(i), stepDefinitions[i]);
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedPropertiesWithoutUndo();
|
||||
EditorUtility.SetDirty(pattern);
|
||||
return pattern;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 단일 패턴 스텝 데이터를 SerializedProperty에 기록합니다.
|
||||
/// </summary>
|
||||
private static void ConfigurePatternStep(SerializedProperty stepProperty, PatternStepDefinition definition)
|
||||
{
|
||||
stepProperty.FindPropertyRelative("Type").enumValueIndex = (int)definition.StepType;
|
||||
stepProperty.FindPropertyRelative("Skill").objectReferenceValue = definition.Skill;
|
||||
stepProperty.FindPropertyRelative("Duration").floatValue = definition.Duration;
|
||||
|
||||
SerializedProperty chargeDataProperty = stepProperty.FindPropertyRelative("ChargeData");
|
||||
if (chargeDataProperty == null)
|
||||
return;
|
||||
|
||||
chargeDataProperty.FindPropertyRelative("requiredDamageRatio").floatValue = definition.RequiredDamageRatio;
|
||||
chargeDataProperty.FindPropertyRelative("telegraphAbnormality").objectReferenceValue = definition.TelegraphAbnormality;
|
||||
chargeDataProperty.FindPropertyRelative("staggerDuration").floatValue = definition.StaggerDuration;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 패턴 스텝 정의를 간단히 구성하기 위한 헬퍼입니다.
|
||||
/// </summary>
|
||||
private sealed class PatternStepDefinition
|
||||
{
|
||||
public PatternStepType StepType { get; private set; }
|
||||
public SkillData Skill { get; private set; }
|
||||
public float Duration { get; private set; }
|
||||
public AbnormalityData TelegraphAbnormality { get; private set; }
|
||||
public float RequiredDamageRatio { get; private set; }
|
||||
public float StaggerDuration { get; private set; }
|
||||
|
||||
public static PatternStepDefinition CreateSkillStep(SkillData skill)
|
||||
{
|
||||
return new PatternStepDefinition
|
||||
{
|
||||
StepType = PatternStepType.Skill,
|
||||
Skill = skill,
|
||||
Duration = 0f,
|
||||
};
|
||||
}
|
||||
|
||||
public static PatternStepDefinition CreateWaitStep(float duration)
|
||||
{
|
||||
return new PatternStepDefinition
|
||||
{
|
||||
StepType = PatternStepType.Wait,
|
||||
Duration = duration,
|
||||
};
|
||||
}
|
||||
|
||||
public static PatternStepDefinition CreateChargeWaitStep(float duration, AbnormalityData telegraphAbnormality, float requiredDamageRatio, float staggerDuration)
|
||||
{
|
||||
return new PatternStepDefinition
|
||||
{
|
||||
StepType = PatternStepType.ChargeWait,
|
||||
Duration = duration,
|
||||
TelegraphAbnormality = telegraphAbnormality,
|
||||
RequiredDamageRatio = requiredDamageRatio,
|
||||
StaggerDuration = staggerDuration,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 24197da57a89a9728a1e63c18da18c80
|
||||
418
Assets/_Game/Scripts/Enemy/BossBehaviorRuntimeState.cs
Normal file
418
Assets/_Game/Scripts/Enemy/BossBehaviorRuntimeState.cs
Normal file
@@ -0,0 +1,418 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Colosseum.AI;
|
||||
using Colosseum.Abnormalities;
|
||||
using Colosseum.Skills;
|
||||
|
||||
using Unity.Behavior;
|
||||
using Unity.Netcode;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace Colosseum.Enemy
|
||||
{
|
||||
/// <summary>
|
||||
/// 마지막 패턴 실행 결과입니다.
|
||||
/// </summary>
|
||||
public enum BossPatternExecutionResult
|
||||
{
|
||||
None,
|
||||
Running,
|
||||
Succeeded,
|
||||
Failed,
|
||||
Cancelled,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 보스 BT가 읽고 쓰는 런타임 전투 상태를 보관합니다.
|
||||
/// 타겟, 페이즈 진행 상태, 패턴 쿨다운 같은 전투 런타임 결과를 외부 시스템과 공유합니다.
|
||||
/// </summary>
|
||||
[DisallowMultipleComponent]
|
||||
[RequireComponent(typeof(BossEnemy))]
|
||||
[RequireComponent(typeof(SkillController))]
|
||||
public class BossBehaviorRuntimeState : NetworkBehaviour
|
||||
{
|
||||
[Header("References")]
|
||||
[SerializeField] protected BossEnemy bossEnemy;
|
||||
[SerializeField] protected EnemyBase enemyBase;
|
||||
[SerializeField] protected SkillController skillController;
|
||||
[SerializeField] protected AbnormalityManager abnormalityManager;
|
||||
[SerializeField] protected UnityEngine.AI.NavMeshAgent navMeshAgent;
|
||||
[SerializeField] protected BehaviorGraphAgent behaviorGraphAgent;
|
||||
|
||||
[Header("Pattern Flow")]
|
||||
[Tooltip("대형 패턴(시그니처/기동/조합) 직후 기본 패턴 최소 순환 횟수")]
|
||||
[Min(0)] [SerializeField] protected int basicLoopMinCountAfterBigPattern = 2;
|
||||
|
||||
[Header("시그니처 효과 설정")]
|
||||
[Tooltip("시그니처 패턴 차단에 필요한 누적 피해 비율")]
|
||||
[Range(0f, 1f)] [SerializeField] protected float signatureRequiredDamageRatio = 0.1f;
|
||||
|
||||
[Tooltip("시그니처 준비 상태를 나타내는 이상상태")]
|
||||
[SerializeField] protected AbnormalityData signatureTelegraphAbnormality;
|
||||
|
||||
[Tooltip("시그니처 차단 성공 시 보스가 멈추는 시간")]
|
||||
[Min(0f)] [SerializeField] protected float signatureSuccessStaggerDuration = 2f;
|
||||
|
||||
[Tooltip("시그니처 실패 시 모든 플레이어에게 적용할 디버프")]
|
||||
[SerializeField] protected AbnormalityData signatureFailureAbnormality;
|
||||
|
||||
[Tooltip("시그니처 실패 시 모든 플레이어에게 주는 기본 피해")]
|
||||
[Min(0f)] [SerializeField] protected float signatureFailureDamage = 40f;
|
||||
|
||||
[Tooltip("시그니처 실패 시 넉백이 적용되는 반경")]
|
||||
[Min(0f)] [SerializeField] protected float signatureFailureKnockbackRadius = 8f;
|
||||
|
||||
[Tooltip("시그니처 실패 시 다운이 적용되는 반경")]
|
||||
[Min(0f)] [SerializeField] protected float signatureFailureDownRadius = 3f;
|
||||
|
||||
[Tooltip("시그니처 실패 시 넉백 속도")]
|
||||
[Min(0f)] [SerializeField] protected float signatureFailureKnockbackSpeed = 12f;
|
||||
|
||||
[Tooltip("시그니처 실패 시 넉백 지속 시간")]
|
||||
[Min(0f)] [SerializeField] protected float signatureFailureKnockbackDuration = 0.35f;
|
||||
|
||||
[Tooltip("시그니처 실패 시 다운 지속 시간")]
|
||||
[Min(0f)] [SerializeField] protected float signatureFailureDownDuration = 2f;
|
||||
|
||||
[Header("Phase State")]
|
||||
[Tooltip("BT가 관리하는 최대 페이즈 수")]
|
||||
[Min(1)] [SerializeField] protected int maxPatternPhase = 3;
|
||||
|
||||
[Tooltip("디버그 로그 출력 여부")]
|
||||
[SerializeField] protected bool debugMode = false;
|
||||
|
||||
protected readonly Dictionary<BossPatternData, float> patternCooldownTracker = new Dictionary<BossPatternData, float>();
|
||||
protected readonly Dictionary<string, bool> customPhaseConditions = new Dictionary<string, bool>();
|
||||
|
||||
protected GameObject currentTarget;
|
||||
protected int meleePatternCounter;
|
||||
protected int basicLoopCountSinceLastBigPattern;
|
||||
protected int currentPatternPhase = 1;
|
||||
protected float currentPhaseStartTime;
|
||||
protected BossPatternExecutionResult lastPatternExecutionResult;
|
||||
protected BossPatternData lastExecutedPattern;
|
||||
|
||||
/// <summary>
|
||||
/// 현재 전투 대상
|
||||
/// </summary>
|
||||
public GameObject CurrentTarget => currentTarget;
|
||||
|
||||
/// <summary>
|
||||
/// BT가 관리하는 현재 페이즈
|
||||
/// </summary>
|
||||
public int CurrentPatternPhase => Mathf.Clamp(currentPatternPhase, 1, Mathf.Max(1, maxPatternPhase));
|
||||
|
||||
/// <summary>
|
||||
/// BT가 관리하는 최대 페이즈 수
|
||||
/// </summary>
|
||||
public int MaxPatternPhase => Mathf.Max(1, maxPatternPhase);
|
||||
|
||||
/// <summary>
|
||||
/// 현재 페이즈의 경과 시간
|
||||
/// </summary>
|
||||
public float PhaseElapsedTime => Time.time - currentPhaseStartTime;
|
||||
|
||||
/// <summary>
|
||||
/// 마지막 대형 패턴 이후 누적된 기본 루프 횟수
|
||||
/// </summary>
|
||||
public int BasicLoopCountSinceLastBigPattern => basicLoopCountSinceLastBigPattern;
|
||||
|
||||
/// <summary>
|
||||
/// 마지막 패턴 실행 결과
|
||||
/// </summary>
|
||||
public BossPatternExecutionResult LastPatternExecutionResult => lastPatternExecutionResult;
|
||||
|
||||
/// <summary>
|
||||
/// 마지막으로 실행한 패턴
|
||||
/// </summary>
|
||||
public BossPatternData LastExecutedPattern => lastExecutedPattern;
|
||||
|
||||
/// <summary>
|
||||
/// EnemyBase 접근자
|
||||
/// </summary>
|
||||
public EnemyBase EnemyBase => enemyBase;
|
||||
|
||||
/// <summary>
|
||||
/// 디버그 로그 출력 여부
|
||||
/// </summary>
|
||||
public bool DebugModeEnabled => debugMode;
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 실패 시 모든 플레이어에게 주는 기본 피해
|
||||
/// </summary>
|
||||
public float SignatureFailureDamage => signatureFailureDamage;
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 실패 시 모든 플레이어에게 적용할 디버프
|
||||
/// </summary>
|
||||
public AbnormalityData SignatureFailureAbnormality => signatureFailureAbnormality;
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 실패 시 넉백이 적용되는 반경
|
||||
/// </summary>
|
||||
public float SignatureFailureKnockbackRadius => signatureFailureKnockbackRadius;
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 실패 시 다운이 적용되는 반경
|
||||
/// </summary>
|
||||
public float SignatureFailureDownRadius => signatureFailureDownRadius;
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 실패 시 넉백 속도
|
||||
/// </summary>
|
||||
public float SignatureFailureKnockbackSpeed => signatureFailureKnockbackSpeed;
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 실패 시 넉백 지속 시간
|
||||
/// </summary>
|
||||
public float SignatureFailureKnockbackDuration => signatureFailureKnockbackDuration;
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 실패 시 다운 지속 시간
|
||||
/// </summary>
|
||||
public float SignatureFailureDownDuration => signatureFailureDownDuration;
|
||||
|
||||
/// <summary>
|
||||
/// 마지막 충전 차단 시 설정된 경직 시간 (BossPatternActionBase가 설정)
|
||||
/// </summary>
|
||||
public float LastChargeStaggerDuration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 마지막 패턴 실행에서 충전이 차단되었는지 여부.
|
||||
/// BT 노드(IsChargeBrokenCondition)에서 판독합니다.
|
||||
/// </summary>
|
||||
public bool WasChargeBroken { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 기절 등으로 인해 보스 전투 로직을 진행할 수 없는 상태인지 여부
|
||||
/// </summary>
|
||||
public bool IsBehaviorSuppressed => abnormalityManager != null && abnormalityManager.IsStunned;
|
||||
|
||||
/// <summary>
|
||||
protected virtual void Awake()
|
||||
{
|
||||
ResolveReferences();
|
||||
ResetPhaseState();
|
||||
}
|
||||
|
||||
public override void OnNetworkSpawn()
|
||||
{
|
||||
ResolveReferences();
|
||||
ResetPhaseState();
|
||||
|
||||
if (!IsServer)
|
||||
enabled = false;
|
||||
}
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
if (!IsServer)
|
||||
return;
|
||||
|
||||
ResolveReferences();
|
||||
if (bossEnemy == null || enemyBase == null || skillController == null)
|
||||
return;
|
||||
|
||||
if (bossEnemy.IsDead)
|
||||
return;
|
||||
|
||||
if (IsBehaviorSuppressed)
|
||||
StopMovement();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BT가 선택한 현재 전투 대상을 동기화합니다.
|
||||
/// </summary>
|
||||
public void SetCurrentTarget(GameObject target)
|
||||
{
|
||||
currentTarget = target;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BT가 현재 페이즈 값을 갱신합니다.
|
||||
/// 필요하면 경과 시간 기준도 함께 초기화합니다.
|
||||
/// </summary>
|
||||
public void SetCurrentPatternPhase(int phase, bool resetTimer = true)
|
||||
{
|
||||
currentPatternPhase = Mathf.Clamp(phase, 1, MaxPatternPhase);
|
||||
|
||||
if (resetTimer)
|
||||
currentPhaseStartTime = Time.time;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 현재 페이즈 타이머를 다시 시작합니다.
|
||||
/// </summary>
|
||||
public void RestartCurrentPhaseTimer()
|
||||
{
|
||||
currentPhaseStartTime = Time.time;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 패턴 실행 시작을 기록합니다.
|
||||
/// </summary>
|
||||
public void BeginPatternExecution(BossPatternData pattern)
|
||||
{
|
||||
lastExecutedPattern = pattern;
|
||||
lastPatternExecutionResult = BossPatternExecutionResult.Running;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 패턴 실행 결과를 기록합니다.
|
||||
/// </summary>
|
||||
public void CompletePatternExecution(BossPatternData pattern, BossPatternExecutionResult result)
|
||||
{
|
||||
lastExecutedPattern = pattern;
|
||||
lastPatternExecutionResult = result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 페이즈 커스텀 조건을 기록합니다.
|
||||
/// </summary>
|
||||
public void SetPhaseCustomCondition(string conditionId, bool value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(conditionId))
|
||||
return;
|
||||
|
||||
customPhaseConditions[conditionId] = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 페이즈 커스텀 조건 값을 읽습니다.
|
||||
/// </summary>
|
||||
public bool CheckPhaseCustomCondition(string conditionId)
|
||||
{
|
||||
return !string.IsNullOrEmpty(conditionId)
|
||||
&& customPhaseConditions.TryGetValue(conditionId, out bool value)
|
||||
&& value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 근접 패턴 사용 카운터를 갱신합니다.
|
||||
/// </summary>
|
||||
public void RegisterPatternUse(BossPatternData pattern)
|
||||
{
|
||||
if (pattern == null)
|
||||
return;
|
||||
|
||||
if (pattern.IsMelee)
|
||||
{
|
||||
meleePatternCounter++;
|
||||
basicLoopCountSinceLastBigPattern++;
|
||||
}
|
||||
|
||||
if (pattern.Category == PatternCategory.Punish || pattern.IsBigPattern)
|
||||
{
|
||||
basicLoopCountSinceLastBigPattern = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 로그를 출력합니다.
|
||||
/// </summary>
|
||||
public void LogDebug(string source, string message)
|
||||
{
|
||||
if (debugMode)
|
||||
Debug.Log($"[{source}] {message}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 지정 패턴이 grace period를 통과했는지 반환합니다.
|
||||
/// Punish/Melee/Utility는 항상 허용됩니다.
|
||||
/// </summary>
|
||||
public bool IsPatternGracePeriodAllowed(BossPatternData pattern)
|
||||
{
|
||||
if (pattern == null)
|
||||
return false;
|
||||
|
||||
if (pattern.Category == PatternCategory.Punish)
|
||||
return true;
|
||||
|
||||
if (pattern.IsMelee || pattern.TargetMode == TargetResolveMode.Utility)
|
||||
return true;
|
||||
|
||||
return basicLoopCountSinceLastBigPattern >= basicLoopMinCountAfterBigPattern;
|
||||
}
|
||||
|
||||
public bool IsPatternReady(BossPatternData pattern)
|
||||
{
|
||||
if (pattern == null || pattern.Steps == null || pattern.Steps.Count == 0)
|
||||
return false;
|
||||
|
||||
if (!patternCooldownTracker.TryGetValue(pattern, out float readyTime))
|
||||
return true;
|
||||
|
||||
return Time.time >= readyTime;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 패턴 쿨다운을 설정합니다. BT 노드(BossPatternActionBase)와 코드 폴백 모두에서 호출합니다.
|
||||
/// </summary>
|
||||
public void SetPatternCooldown(BossPatternData pattern)
|
||||
{
|
||||
if (pattern != null)
|
||||
patternCooldownTracker[pattern] = Time.time + pattern.Cooldown;
|
||||
}
|
||||
|
||||
protected void StopMovement()
|
||||
{
|
||||
if (navMeshAgent == null || !navMeshAgent.enabled)
|
||||
return;
|
||||
|
||||
navMeshAgent.isStopped = true;
|
||||
navMeshAgent.ResetPath();
|
||||
}
|
||||
|
||||
protected virtual void ResolveReferences()
|
||||
{
|
||||
if (bossEnemy == null)
|
||||
bossEnemy = GetComponent<BossEnemy>();
|
||||
|
||||
if (enemyBase == null)
|
||||
enemyBase = GetComponent<EnemyBase>();
|
||||
|
||||
if (skillController == null)
|
||||
skillController = GetComponent<SkillController>();
|
||||
|
||||
if (abnormalityManager == null)
|
||||
abnormalityManager = GetComponent<AbnormalityManager>();
|
||||
|
||||
if (navMeshAgent == null)
|
||||
navMeshAgent = GetComponent<UnityEngine.AI.NavMeshAgent>();
|
||||
|
||||
if (behaviorGraphAgent == null)
|
||||
behaviorGraphAgent = GetComponent<BehaviorGraphAgent>();
|
||||
}
|
||||
|
||||
public virtual void ResetPhaseState()
|
||||
{
|
||||
currentPatternPhase = 1;
|
||||
currentPhaseStartTime = Time.time;
|
||||
lastPatternExecutionResult = BossPatternExecutionResult.None;
|
||||
lastExecutedPattern = null;
|
||||
customPhaseConditions.Clear();
|
||||
}
|
||||
|
||||
public override void OnNetworkDespawn()
|
||||
{
|
||||
base.OnNetworkDespawn();
|
||||
}
|
||||
|
||||
private static bool HasAnimatorParameter(Animator animator, string parameterName, AnimatorControllerParameterType parameterType)
|
||||
{
|
||||
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 == parameterType && parameter.name == parameterName)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,848 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Colosseum.AI;
|
||||
using Colosseum.Abnormalities;
|
||||
using Colosseum.Combat;
|
||||
using Colosseum.Player;
|
||||
using Colosseum.Skills;
|
||||
|
||||
using Unity.Behavior;
|
||||
using Unity.Netcode;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace Colosseum.Enemy
|
||||
{
|
||||
/// <summary>
|
||||
/// 보스 공통 전투 BT가 참조하는 전투 컨텍스트입니다.
|
||||
/// 패턴 슬롯, 거리 기준, 페이즈별 주기, 공통 타겟 판정 정보를 제공합니다.
|
||||
/// </summary>
|
||||
[DisallowMultipleComponent]
|
||||
[RequireComponent(typeof(BossEnemy))]
|
||||
[RequireComponent(typeof(SkillController))]
|
||||
public abstract class BossCombatBehaviorContext : NetworkBehaviour
|
||||
{
|
||||
[Header("References")]
|
||||
[SerializeField] protected BossEnemy bossEnemy;
|
||||
[SerializeField] protected EnemyBase enemyBase;
|
||||
[SerializeField] protected SkillController skillController;
|
||||
[SerializeField] protected AbnormalityManager abnormalityManager;
|
||||
[SerializeField] protected UnityEngine.AI.NavMeshAgent navMeshAgent;
|
||||
[SerializeField] protected BehaviorGraphAgent behaviorGraphAgent;
|
||||
|
||||
[Header("Pattern Data")]
|
||||
[Tooltip("기본 근접 압박 패턴")]
|
||||
[FormerlySerializedAs("mainPattern")]
|
||||
[SerializeField] protected BossPatternData primaryPattern;
|
||||
|
||||
[Tooltip("기동 또는 거리 징벌 패턴")]
|
||||
[FormerlySerializedAs("leapPattern")]
|
||||
[SerializeField] protected BossPatternData mobilityPattern;
|
||||
|
||||
[Tooltip("비주 대상 원거리 견제 패턴")]
|
||||
[SerializeField] protected BossPatternData utilityPattern;
|
||||
|
||||
[Tooltip("Phase 3 조합 패턴")]
|
||||
[SerializeField] protected BossPatternData comboPattern;
|
||||
|
||||
[Tooltip("특정 상황에서 우선 발동하는 징벌 패턴")]
|
||||
[FormerlySerializedAs("downPunishPattern")]
|
||||
[SerializeField] protected BossPatternData punishPattern;
|
||||
|
||||
[Tooltip("파티 누킹을 시험하는 시그니처 패턴")]
|
||||
[SerializeField] protected BossPatternData signaturePattern;
|
||||
|
||||
[Header("Phase Thresholds")]
|
||||
[Tooltip("2페이즈 진입 체력 비율")]
|
||||
[Range(0f, 1f)] [SerializeField] protected float phase2HealthThreshold = 0.75f;
|
||||
|
||||
[Tooltip("3페이즈 진입 체력 비율")]
|
||||
[Range(0f, 1f)] [SerializeField] protected float phase3HealthThreshold = 0.4f;
|
||||
|
||||
[Header("Targeting")]
|
||||
[Tooltip("타겟 재탐색 주기")]
|
||||
[FormerlySerializedAs("targetRefreshInterval")]
|
||||
[Min(0.05f)] [SerializeField] protected float primaryTargetRefreshInterval = 0.2f;
|
||||
|
||||
[Tooltip("기동 패턴을 고려하기 시작하는 거리")]
|
||||
[FormerlySerializedAs("leapDistanceThreshold")]
|
||||
[Min(0f)] [SerializeField] protected float mobilityTriggerDistance = 8f;
|
||||
|
||||
[Tooltip("징벌 패턴을 고려할 최대 반경")]
|
||||
[FormerlySerializedAs("downPunishSearchRadius")]
|
||||
[Min(0f)] [SerializeField] protected float punishSearchRadius = 6f;
|
||||
|
||||
[Tooltip("원거리 견제 패턴을 고려하기 시작하는 최소 거리")]
|
||||
[Min(0f)] [SerializeField] protected float utilityTriggerDistance = 5f;
|
||||
|
||||
[Header("Pattern Flow")]
|
||||
[Tooltip("대형 패턴(시그니처/기동/조합) 직후 기본 패턴 최소 순환 횟수")]
|
||||
[Min(0)] [SerializeField] protected int basicLoopMinCountAfterBigPattern = 2;
|
||||
|
||||
[Header("시그니처 효과 설정")]
|
||||
[Tooltip("시그니처 패턴 차단에 필요한 누적 피해 비율")]
|
||||
[Range(0f, 1f)] [SerializeField] protected float signatureRequiredDamageRatio = 0.1f;
|
||||
|
||||
[Tooltip("시그니처 준비 상태를 나타내는 이상상태")]
|
||||
[SerializeField] protected AbnormalityData signatureTelegraphAbnormality;
|
||||
|
||||
[Tooltip("시그니처 차단 성공 시 보스가 멈추는 시간")]
|
||||
[Min(0f)] [SerializeField] protected float signatureSuccessStaggerDuration = 2f;
|
||||
|
||||
[Tooltip("시그니처 실패 시 모든 플레이어에게 적용할 디버프")]
|
||||
[SerializeField] protected AbnormalityData signatureFailureAbnormality;
|
||||
|
||||
[Tooltip("시그니처 실패 시 모든 플레이어에게 주는 기본 피해")]
|
||||
[Min(0f)] [SerializeField] protected float signatureFailureDamage = 40f;
|
||||
|
||||
[Tooltip("시그니처 실패 시 넉백이 적용되는 반경")]
|
||||
[Min(0f)] [SerializeField] protected float signatureFailureKnockbackRadius = 8f;
|
||||
|
||||
[Tooltip("시그니처 실패 시 다운이 적용되는 반경")]
|
||||
[Min(0f)] [SerializeField] protected float signatureFailureDownRadius = 3f;
|
||||
|
||||
[Tooltip("시그니처 실패 시 넉백 속도")]
|
||||
[Min(0f)] [SerializeField] protected float signatureFailureKnockbackSpeed = 12f;
|
||||
|
||||
[Tooltip("시그니처 실패 시 넉백 지속 시간")]
|
||||
[Min(0f)] [SerializeField] protected float signatureFailureKnockbackDuration = 0.35f;
|
||||
|
||||
[Tooltip("시그니처 실패 시 다운 지속 시간")]
|
||||
[Min(0f)] [SerializeField] protected float signatureFailureDownDuration = 2f;
|
||||
|
||||
[Header("Behavior")]
|
||||
[Tooltip("true면 컨텍스트 코드가 AI를 직접 구동합니다. false면 BehaviorGraph가 모든 의사결정을 담당합니다.")]
|
||||
[SerializeField] protected bool disableBehaviorGraph = false;
|
||||
|
||||
[Tooltip("디버그 로그 출력 여부")]
|
||||
[SerializeField] protected bool debugMode = false;
|
||||
|
||||
protected readonly Dictionary<BossPatternData, float> patternCooldownTracker = new Dictionary<BossPatternData, float>();
|
||||
|
||||
protected Coroutine activePatternCoroutine;
|
||||
protected GameObject currentTarget;
|
||||
protected float nextTargetRefreshTime;
|
||||
protected int meleePatternCounter;
|
||||
protected int basicLoopCountSinceLastBigPattern;
|
||||
|
||||
/// <summary>
|
||||
/// 전용 컨텍스트 사용 시 BehaviorGraph를 비활성화할지 여부
|
||||
/// </summary>
|
||||
public bool DisableBehaviorGraph => disableBehaviorGraph;
|
||||
|
||||
/// <summary>
|
||||
/// 기동 패턴을 고려하는 최소 거리
|
||||
/// </summary>
|
||||
public float MobilityTriggerDistance => mobilityTriggerDistance;
|
||||
|
||||
/// <summary>
|
||||
/// 원거리 견제 패턴을 고려하는 최소 거리
|
||||
/// </summary>
|
||||
public float UtilityTriggerDistance => utilityTriggerDistance;
|
||||
|
||||
/// <summary>
|
||||
/// 징벌 패턴을 고려하는 최대 반경
|
||||
/// </summary>
|
||||
public float PunishSearchRadius => punishSearchRadius;
|
||||
|
||||
/// <summary>
|
||||
/// 현재 전투 대상
|
||||
/// </summary>
|
||||
public GameObject CurrentTarget => currentTarget;
|
||||
|
||||
/// <summary>
|
||||
/// EnemyBase 접근자
|
||||
/// </summary>
|
||||
public EnemyBase EnemyBase => enemyBase;
|
||||
|
||||
/// <summary>
|
||||
/// 현재 전투 기준이 되는 주 대상을 반환합니다.
|
||||
/// </summary>
|
||||
public GameObject ResolvePrimaryTarget()
|
||||
{
|
||||
if (IsValidHostileTarget(currentTarget))
|
||||
return currentTarget;
|
||||
|
||||
GameObject highestThreatTarget = enemyBase != null
|
||||
? enemyBase.GetHighestThreatTarget(currentTarget, null, enemyBase.Data != null ? enemyBase.Data.AggroRange : Mathf.Infinity)
|
||||
: null;
|
||||
|
||||
return highestThreatTarget != null ? highestThreatTarget : FindNearestLivingTarget();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 디버그 로그 출력 여부
|
||||
/// </summary>
|
||||
public bool DebugModeEnabled => debugMode;
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 실패 시 모든 플레이어에게 주는 기본 피해
|
||||
/// </summary>
|
||||
public float SignatureFailureDamage => signatureFailureDamage;
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 실패 시 모든 플레이어에게 적용할 디버프
|
||||
/// </summary>
|
||||
public AbnormalityData SignatureFailureAbnormality => signatureFailureAbnormality;
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 실패 시 넉백이 적용되는 반경
|
||||
/// </summary>
|
||||
public float SignatureFailureKnockbackRadius => signatureFailureKnockbackRadius;
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 실패 시 다운이 적용되는 반경
|
||||
/// </summary>
|
||||
public float SignatureFailureDownRadius => signatureFailureDownRadius;
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 실패 시 넉백 속도
|
||||
/// </summary>
|
||||
public float SignatureFailureKnockbackSpeed => signatureFailureKnockbackSpeed;
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 실패 시 넉백 지속 시간
|
||||
/// </summary>
|
||||
public float SignatureFailureKnockbackDuration => signatureFailureKnockbackDuration;
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 실패 시 다운 지속 시간
|
||||
/// </summary>
|
||||
public float SignatureFailureDownDuration => signatureFailureDownDuration;
|
||||
|
||||
/// <summary>
|
||||
/// 마지막 충전 차단 시 설정된 경직 시간 (BossPatternActionBase가 설정)
|
||||
/// </summary>
|
||||
public float LastChargeStaggerDuration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 기절 등으로 인해 보스 전투 로직을 진행할 수 없는 상태인지 여부
|
||||
/// </summary>
|
||||
public bool IsBehaviorSuppressed => abnormalityManager != null && abnormalityManager.IsStunned;
|
||||
|
||||
/// <summary>
|
||||
/// 현재 보스 패턴 페이즈
|
||||
/// </summary>
|
||||
public int CurrentPatternPhase
|
||||
{
|
||||
get
|
||||
{
|
||||
float healthRatio = bossEnemy != null && bossEnemy.MaxHealth > 0f
|
||||
? bossEnemy.CurrentHealth / bossEnemy.MaxHealth
|
||||
: 1f;
|
||||
|
||||
if (healthRatio <= phase3HealthThreshold)
|
||||
return 3;
|
||||
|
||||
if (healthRatio <= phase2HealthThreshold)
|
||||
return 2;
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Awake()
|
||||
{
|
||||
ResolveReferences();
|
||||
}
|
||||
|
||||
public override void OnNetworkSpawn()
|
||||
{
|
||||
ResolveReferences();
|
||||
|
||||
if (!IsServer)
|
||||
enabled = false;
|
||||
}
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
if (!IsServer)
|
||||
return;
|
||||
|
||||
ResolveReferences();
|
||||
if (bossEnemy == null || enemyBase == null || skillController == null)
|
||||
return;
|
||||
|
||||
if (bossEnemy.IsDead || bossEnemy.IsTransitioning)
|
||||
return;
|
||||
|
||||
if (IsBehaviorSuppressed)
|
||||
{
|
||||
StopMovement();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!disableBehaviorGraph)
|
||||
return;
|
||||
|
||||
RefreshTargetIfNeeded();
|
||||
UpdateMovement();
|
||||
|
||||
if (skillController.IsPlayingAnimation)
|
||||
return;
|
||||
|
||||
// 1. 다운 추가타 (최우선 인터럽트, grace period 면제)
|
||||
if (TryStartPunishPattern())
|
||||
return;
|
||||
|
||||
// 2. 조합 패턴 (Phase 3, 드물게)
|
||||
if (TryStartComboPattern())
|
||||
return;
|
||||
|
||||
// 4. 기동 패턴 (거리 기반 조건부)
|
||||
if (TryStartMobilityPattern())
|
||||
return;
|
||||
|
||||
// 5. 원거리 견제 (보조)
|
||||
if (TryStartUtilityPattern())
|
||||
return;
|
||||
|
||||
// 6. 기본 루프
|
||||
TryStartPrimaryLoopPattern();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 근접 패턴 사용 카운터를 갱신합니다.
|
||||
/// </summary>
|
||||
public void RegisterPatternUse(BossPatternData pattern)
|
||||
{
|
||||
if (pattern == null)
|
||||
return;
|
||||
|
||||
if (pattern.IsMelee)
|
||||
{
|
||||
meleePatternCounter++;
|
||||
basicLoopCountSinceLastBigPattern++;
|
||||
}
|
||||
|
||||
if (pattern.Category == PatternCategory.Punish || pattern.IsBigPattern)
|
||||
{
|
||||
basicLoopCountSinceLastBigPattern = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 살아 있는 적대 대상인지 확인합니다.
|
||||
/// </summary>
|
||||
public bool IsValidHostileTarget(GameObject candidate)
|
||||
{
|
||||
if (candidate == null || !candidate.activeInHierarchy)
|
||||
return false;
|
||||
|
||||
if (Team.IsSameTeam(gameObject, candidate))
|
||||
return false;
|
||||
|
||||
IDamageable damageable = candidate.GetComponent<IDamageable>();
|
||||
return damageable == null || !damageable.IsDead;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 기동 패턴 대상으로 유효한지 확인합니다.
|
||||
/// </summary>
|
||||
public bool IsValidMobilityTarget(GameObject candidate)
|
||||
{
|
||||
if (!IsValidHostileTarget(candidate))
|
||||
return false;
|
||||
|
||||
float maxDistance = enemyBase != null && enemyBase.Data != null ? enemyBase.Data.AggroRange : 20f;
|
||||
float distance = Vector3.Distance(transform.position, candidate.transform.position);
|
||||
return distance >= mobilityTriggerDistance && distance <= maxDistance;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 기동 패턴 대상으로 사용할 수 있는 가장 먼 유효 타겟을 찾습니다.
|
||||
/// </summary>
|
||||
public GameObject FindMobilityTarget()
|
||||
{
|
||||
GameObject[] candidates = GameObject.FindGameObjectsWithTag("Player");
|
||||
GameObject farthestTarget = null;
|
||||
float bestDistance = mobilityTriggerDistance;
|
||||
float maxDistance = enemyBase != null && enemyBase.Data != null ? enemyBase.Data.AggroRange : 20f;
|
||||
|
||||
for (int i = 0; i < candidates.Length; i++)
|
||||
{
|
||||
GameObject candidate = candidates[i];
|
||||
if (!IsValidMobilityTarget(candidate))
|
||||
continue;
|
||||
|
||||
float distance = Vector3.Distance(transform.position, candidate.transform.position);
|
||||
if (distance > maxDistance || distance <= bestDistance)
|
||||
continue;
|
||||
|
||||
bestDistance = distance;
|
||||
farthestTarget = candidate;
|
||||
}
|
||||
|
||||
return farthestTarget;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 원거리 견제 패턴 대상으로 유효한지 확인합니다.
|
||||
/// </summary>
|
||||
public bool IsValidUtilityTarget(GameObject candidate)
|
||||
{
|
||||
if (!IsValidHostileTarget(candidate))
|
||||
return false;
|
||||
|
||||
if (candidate == ResolvePrimaryTarget())
|
||||
return false;
|
||||
|
||||
float maxDistance = enemyBase != null && enemyBase.Data != null ? enemyBase.Data.AggroRange : 20f;
|
||||
float distance = Vector3.Distance(transform.position, candidate.transform.position);
|
||||
return distance >= utilityTriggerDistance && distance <= maxDistance;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 현재 주 대상이 아닌 원거리 견제 대상을 찾습니다.
|
||||
/// </summary>
|
||||
public GameObject FindUtilityTarget()
|
||||
{
|
||||
PlayerNetworkController[] players = FindObjectsByType<PlayerNetworkController>(FindObjectsSortMode.None);
|
||||
List<GameObject> validTargets = new List<GameObject>();
|
||||
GameObject primaryTarget = ResolvePrimaryTarget();
|
||||
|
||||
for (int i = 0; i < players.Length; i++)
|
||||
{
|
||||
PlayerNetworkController player = players[i];
|
||||
if (player == null || player.IsDead || !player.gameObject.activeInHierarchy)
|
||||
continue;
|
||||
|
||||
GameObject candidate = player.gameObject;
|
||||
if (!IsValidUtilityTarget(candidate))
|
||||
continue;
|
||||
|
||||
validTargets.Add(candidate);
|
||||
}
|
||||
|
||||
if (validTargets.Count == 0)
|
||||
{
|
||||
if (IsValidHostileTarget(primaryTarget))
|
||||
{
|
||||
float maxDistance = enemyBase != null && enemyBase.Data != null ? enemyBase.Data.AggroRange : 20f;
|
||||
float distance = Vector3.Distance(transform.position, primaryTarget.transform.position);
|
||||
if (distance >= utilityTriggerDistance && distance <= maxDistance)
|
||||
return primaryTarget;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
int randomIndex = UnityEngine.Random.Range(0, validTargets.Count);
|
||||
return validTargets[randomIndex];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 가장 가까운 생존 플레이어를 찾습니다.
|
||||
/// </summary>
|
||||
public GameObject FindNearestLivingTarget()
|
||||
{
|
||||
PlayerNetworkController[] players = FindObjectsByType<PlayerNetworkController>(FindObjectsSortMode.None);
|
||||
|
||||
GameObject nearestTarget = null;
|
||||
float nearestDistance = float.MaxValue;
|
||||
float aggroRange = enemyBase != null && enemyBase.Data != null ? enemyBase.Data.AggroRange : Mathf.Infinity;
|
||||
|
||||
for (int i = 0; i < players.Length; i++)
|
||||
{
|
||||
PlayerNetworkController player = players[i];
|
||||
if (player == null || player.IsDead || !player.gameObject.activeInHierarchy)
|
||||
continue;
|
||||
|
||||
GameObject candidate = player.gameObject;
|
||||
if (!IsValidHostileTarget(candidate))
|
||||
continue;
|
||||
|
||||
float distance = Vector3.Distance(transform.position, candidate.transform.position);
|
||||
if (distance > aggroRange || distance >= nearestDistance)
|
||||
continue;
|
||||
|
||||
nearestDistance = distance;
|
||||
nearestTarget = candidate;
|
||||
}
|
||||
|
||||
return nearestTarget;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 로그를 출력합니다.
|
||||
/// </summary>
|
||||
public void LogDebug(string source, string message)
|
||||
{
|
||||
if (debugMode)
|
||||
Debug.Log($"[{source}] {message}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 모든 패턴 슬롯에 포함된 고유 스킬 목록을 반환합니다. 디버그 용도로 사용됩니다.
|
||||
/// </summary>
|
||||
public List<SkillData> GetAllPatternSkills()
|
||||
{
|
||||
HashSet<SkillData> skillSet = new HashSet<SkillData>();
|
||||
BossPatternData[] allPatterns = { primaryPattern, mobilityPattern, utilityPattern, comboPattern, punishPattern, signaturePattern };
|
||||
for (int i = 0; i < allPatterns.Length; i++)
|
||||
{
|
||||
BossPatternData pattern = allPatterns[i];
|
||||
if (pattern?.Steps == null)
|
||||
continue;
|
||||
for (int j = 0; j < pattern.Steps.Count; j++)
|
||||
{
|
||||
PatternStep step = pattern.Steps[j];
|
||||
if (step.Skill != null)
|
||||
skillSet.Add(step.Skill);
|
||||
}
|
||||
}
|
||||
return new List<SkillData>(skillSet);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 지정 패턴이 grace period를 통과했는지 반환합니다.
|
||||
/// Punish/Melee/Utility는 항상 허용됩니다.
|
||||
/// </summary>
|
||||
public bool IsPatternGracePeriodAllowed(BossPatternData pattern)
|
||||
{
|
||||
if (pattern == null)
|
||||
return false;
|
||||
|
||||
if (pattern.Category == PatternCategory.Punish)
|
||||
return true;
|
||||
|
||||
if (pattern.IsMelee || pattern.TargetMode == TargetResolveMode.Utility)
|
||||
return true;
|
||||
|
||||
return basicLoopCountSinceLastBigPattern >= basicLoopMinCountAfterBigPattern;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 조합 패턴 사용 가능 여부를 반환합니다.
|
||||
/// </summary>
|
||||
public bool IsComboPatternReady()
|
||||
{
|
||||
if (!IsServer || bossEnemy == null || skillController == null)
|
||||
return false;
|
||||
|
||||
if (IsBehaviorSuppressed)
|
||||
return false;
|
||||
|
||||
if (activePatternCoroutine != null)
|
||||
return false;
|
||||
|
||||
if (bossEnemy.IsDead || bossEnemy.IsTransitioning || skillController.IsPlayingAnimation)
|
||||
return false;
|
||||
|
||||
if (!IsPatternGracePeriodAllowed(comboPattern))
|
||||
return false;
|
||||
|
||||
return IsPatternReady(comboPattern);
|
||||
}
|
||||
|
||||
protected virtual bool TryStartPrimaryLoopPattern()
|
||||
{
|
||||
if (currentTarget == null)
|
||||
return false;
|
||||
|
||||
float distanceToTarget = Vector3.Distance(transform.position, currentTarget.transform.position);
|
||||
float attackRange = enemyBase != null && enemyBase.Data != null ? enemyBase.Data.AttackRange : 2f;
|
||||
if (distanceToTarget > attackRange + 0.25f)
|
||||
return false;
|
||||
|
||||
BossPatternData selectedPattern = SelectPrimaryLoopPattern();
|
||||
if (selectedPattern == null)
|
||||
return false;
|
||||
|
||||
StartPattern(selectedPattern, currentTarget);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected virtual bool TryStartMobilityPattern()
|
||||
{
|
||||
BossPatternData pattern = mobilityPattern;
|
||||
if (!IsPatternReady(pattern))
|
||||
return false;
|
||||
|
||||
GameObject target = FindMobilityTarget();
|
||||
if (target == null)
|
||||
return false;
|
||||
|
||||
currentTarget = target;
|
||||
StartPattern(pattern, target);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected virtual bool TryStartUtilityPattern()
|
||||
{
|
||||
BossPatternData pattern = utilityPattern;
|
||||
if (!IsPatternReady(pattern))
|
||||
return false;
|
||||
|
||||
GameObject target = FindUtilityTarget();
|
||||
if (target == null)
|
||||
return false;
|
||||
|
||||
currentTarget = target;
|
||||
StartPattern(pattern, target);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 다운 대상이 존재하면 징벌 패턴을 발동합니다.
|
||||
/// </summary>
|
||||
protected virtual bool TryStartPunishPattern()
|
||||
{
|
||||
BossPatternData pattern = punishPattern;
|
||||
if (!IsPatternReady(pattern))
|
||||
return false;
|
||||
|
||||
HitReactionController[] hitReactionControllers = FindObjectsByType<HitReactionController>(FindObjectsSortMode.None);
|
||||
GameObject nearestDownedTarget = null;
|
||||
float nearestDistance = float.MaxValue;
|
||||
|
||||
for (int i = 0; i < hitReactionControllers.Length; i++)
|
||||
{
|
||||
HitReactionController controller = hitReactionControllers[i];
|
||||
if (controller == null || !controller.IsDowned)
|
||||
continue;
|
||||
|
||||
GameObject candidate = controller.gameObject;
|
||||
if (candidate == null || !candidate.activeInHierarchy)
|
||||
continue;
|
||||
|
||||
if (Team.IsSameTeam(gameObject, candidate))
|
||||
continue;
|
||||
|
||||
IDamageable damageable = candidate.GetComponent<IDamageable>();
|
||||
if (damageable != null && damageable.IsDead)
|
||||
continue;
|
||||
|
||||
float distance = Vector3.Distance(transform.position, candidate.transform.position);
|
||||
if (distance > punishSearchRadius || distance >= nearestDistance)
|
||||
continue;
|
||||
|
||||
nearestDistance = distance;
|
||||
nearestDownedTarget = candidate;
|
||||
}
|
||||
|
||||
if (nearestDownedTarget == null)
|
||||
return false;
|
||||
|
||||
currentTarget = nearestDownedTarget;
|
||||
StartPattern(pattern, nearestDownedTarget);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Phase 3 조합 패턴을 발동합니다.
|
||||
/// </summary>
|
||||
protected virtual bool TryStartComboPattern()
|
||||
{
|
||||
if (!IsComboPatternReady())
|
||||
return false;
|
||||
|
||||
currentTarget = ResolvePrimaryTarget();
|
||||
StartPattern(comboPattern, currentTarget);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected virtual BossPatternData SelectPrimaryLoopPattern()
|
||||
{
|
||||
if (!IsPatternReady(primaryPattern))
|
||||
return null;
|
||||
|
||||
meleePatternCounter++;
|
||||
return primaryPattern;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 기본 패턴을 선택하고 카운터를 갱신합니다.
|
||||
/// </summary>
|
||||
public BossPatternData SelectAndRegisterBasicLoopPattern()
|
||||
{
|
||||
if (!IsPatternReady(primaryPattern))
|
||||
return null;
|
||||
|
||||
RegisterPatternUse(primaryPattern);
|
||||
return primaryPattern;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 기본 패턴이 사용 가능한지 확인합니다.
|
||||
/// 상태 변경 없이 순수 검사만 수행합니다.
|
||||
/// </summary>
|
||||
public bool IsBasicLoopReady()
|
||||
{
|
||||
return IsPatternReady(primaryPattern);
|
||||
}
|
||||
|
||||
protected virtual void StartPattern(BossPatternData pattern, GameObject target)
|
||||
{
|
||||
if (pattern == null || activePatternCoroutine != null)
|
||||
return;
|
||||
|
||||
currentTarget = target;
|
||||
LogDebug(GetType().Name, $"패턴 시작: {pattern.PatternName} / Target={(target != null ? target.name : "None")} / Phase={CurrentPatternPhase}");
|
||||
CombatBalanceTracker.RecordBossPattern(pattern.PatternName);
|
||||
activePatternCoroutine = StartCoroutine(RunPatternCoroutine(pattern, target));
|
||||
}
|
||||
|
||||
protected virtual IEnumerator RunPatternCoroutine(BossPatternData pattern, GameObject target)
|
||||
{
|
||||
StopMovement();
|
||||
bool completed = true;
|
||||
|
||||
for (int i = 0; i < pattern.Steps.Count; i++)
|
||||
{
|
||||
PatternStep step = pattern.Steps[i];
|
||||
if (step.Type == PatternStepType.Wait)
|
||||
{
|
||||
yield return new WaitForSeconds(step.Duration);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (step.Skill == null)
|
||||
{
|
||||
completed = false;
|
||||
Debug.LogWarning($"[{GetType().Name}] 패턴 스텝 스킬이 비어 있습니다. Pattern={pattern.PatternName}, Index={i}");
|
||||
break;
|
||||
}
|
||||
|
||||
if (step.Skill.JumpToTarget)
|
||||
{
|
||||
GameObject jumpTarget = FindMobilityTarget();
|
||||
if (jumpTarget == null)
|
||||
{
|
||||
LogDebug(GetType().Name, $"점프 대상 없음, 패턴 조기 종료: {pattern.PatternName}");
|
||||
break;
|
||||
}
|
||||
|
||||
target = jumpTarget;
|
||||
currentTarget = jumpTarget;
|
||||
enemyBase?.SetJumpTarget(jumpTarget.transform.position);
|
||||
}
|
||||
|
||||
if (!skillController.ExecuteSkill(step.Skill))
|
||||
{
|
||||
completed = false;
|
||||
LogDebug(GetType().Name, $"스킬 실행 실패: {step.Skill.SkillName}");
|
||||
break;
|
||||
}
|
||||
|
||||
yield return new WaitUntil(() => skillController == null || !skillController.IsPlayingAnimation || bossEnemy == null || bossEnemy.IsDead);
|
||||
if (bossEnemy == null || bossEnemy.IsDead)
|
||||
break;
|
||||
}
|
||||
|
||||
if (completed)
|
||||
{
|
||||
patternCooldownTracker[pattern] = Time.time + pattern.Cooldown;
|
||||
}
|
||||
|
||||
activePatternCoroutine = null;
|
||||
currentTarget = target;
|
||||
}
|
||||
|
||||
protected bool IsPatternReady(BossPatternData pattern)
|
||||
{
|
||||
if (pattern == null || pattern.Steps == null || pattern.Steps.Count == 0)
|
||||
return false;
|
||||
|
||||
if (!patternCooldownTracker.TryGetValue(pattern, out float readyTime))
|
||||
return true;
|
||||
|
||||
return Time.time >= readyTime;
|
||||
}
|
||||
|
||||
protected virtual void RefreshTargetIfNeeded()
|
||||
{
|
||||
if (Time.time < nextTargetRefreshTime)
|
||||
return;
|
||||
|
||||
nextTargetRefreshTime = Time.time + primaryTargetRefreshInterval;
|
||||
GameObject highestThreatTarget = enemyBase.GetHighestThreatTarget(currentTarget, null, enemyBase.Data != null ? enemyBase.Data.AggroRange : Mathf.Infinity);
|
||||
currentTarget = highestThreatTarget != null ? highestThreatTarget : FindNearestLivingTarget();
|
||||
}
|
||||
|
||||
protected virtual void UpdateMovement()
|
||||
{
|
||||
if (navMeshAgent == null || !navMeshAgent.enabled)
|
||||
return;
|
||||
|
||||
if (skillController != null && skillController.IsPlayingAnimation)
|
||||
{
|
||||
StopMovement();
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentTarget == null)
|
||||
{
|
||||
StopMovement();
|
||||
return;
|
||||
}
|
||||
|
||||
float attackRange = enemyBase != null && enemyBase.Data != null ? enemyBase.Data.AttackRange : 2f;
|
||||
float distanceToTarget = Vector3.Distance(transform.position, currentTarget.transform.position);
|
||||
if (distanceToTarget <= attackRange)
|
||||
{
|
||||
StopMovement();
|
||||
return;
|
||||
}
|
||||
|
||||
navMeshAgent.isStopped = false;
|
||||
navMeshAgent.stoppingDistance = attackRange;
|
||||
navMeshAgent.SetDestination(currentTarget.transform.position);
|
||||
}
|
||||
|
||||
protected void StopMovement()
|
||||
{
|
||||
if (navMeshAgent == null || !navMeshAgent.enabled)
|
||||
return;
|
||||
|
||||
navMeshAgent.isStopped = true;
|
||||
navMeshAgent.ResetPath();
|
||||
}
|
||||
|
||||
protected virtual void ResolveReferences()
|
||||
{
|
||||
if (bossEnemy == null)
|
||||
bossEnemy = GetComponent<BossEnemy>();
|
||||
|
||||
if (enemyBase == null)
|
||||
enemyBase = GetComponent<EnemyBase>();
|
||||
|
||||
if (skillController == null)
|
||||
skillController = GetComponent<SkillController>();
|
||||
|
||||
if (abnormalityManager == null)
|
||||
abnormalityManager = GetComponent<AbnormalityManager>();
|
||||
|
||||
if (navMeshAgent == null)
|
||||
navMeshAgent = GetComponent<UnityEngine.AI.NavMeshAgent>();
|
||||
|
||||
if (behaviorGraphAgent == null)
|
||||
behaviorGraphAgent = GetComponent<BehaviorGraphAgent>();
|
||||
}
|
||||
|
||||
public override void OnNetworkDespawn()
|
||||
{
|
||||
base.OnNetworkDespawn();
|
||||
}
|
||||
|
||||
private static bool HasAnimatorParameter(Animator animator, string parameterName, AnimatorControllerParameterType parameterType)
|
||||
{
|
||||
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 == parameterType && parameter.name == parameterName)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,54 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Unity.Netcode;
|
||||
using Unity.Behavior;
|
||||
using Unity.Netcode;
|
||||
using UnityEngine;
|
||||
|
||||
using Colosseum.Stats;
|
||||
|
||||
namespace Colosseum.Enemy
|
||||
{
|
||||
/// <summary>
|
||||
/// 보스 캐릭터. 페이즈 시스템과 동적 AI 전환을 지원합니다.
|
||||
/// Unity Behavior 패키지를 사용하여 Behavior Tree 기반 AI를 구현합니다.
|
||||
/// 보스 캐릭터입니다.
|
||||
/// </summary>
|
||||
|
||||
public class BossEnemy : EnemyBase
|
||||
{
|
||||
[Header("Boss Settings")]
|
||||
[Tooltip("보스 페이즈 데이터 목록 (순서대로 전환)")]
|
||||
[SerializeField] private List<BossPhaseData> phases = new();
|
||||
|
||||
[Tooltip("초기 Behavior Graph")]
|
||||
[SerializeField] private BehaviorGraph initialBehaviorGraph;
|
||||
|
||||
[Header("Phase Settings")]
|
||||
[Tooltip("페이즈 전환 시 무적 시간")]
|
||||
[Min(0f)] [SerializeField] private float phaseTransitionInvincibilityTime = 2f;
|
||||
|
||||
[Tooltip("페이즈 전환 연출 시간")]
|
||||
[Min(0f)] [SerializeField] private float phaseTransitionDuration = 3f;
|
||||
|
||||
[Header("Debug")]
|
||||
[SerializeField] private bool debugMode = true;
|
||||
|
||||
// 컴포넌트
|
||||
private BehaviorGraphAgent behaviorAgent;
|
||||
private BossCombatBehaviorContext combatBehaviorContext;
|
||||
|
||||
// 페이즈 상태
|
||||
private int currentPhaseIndex = 0;
|
||||
private bool isTransitioning = false;
|
||||
private float phaseStartTime;
|
||||
private float phaseElapsedTime;
|
||||
private bool isInvincible = false;
|
||||
|
||||
// 커스텀 조건 딕셔너리
|
||||
private Dictionary<string, bool> customConditions = new Dictionary<string, bool>();
|
||||
|
||||
// 이벤트
|
||||
public event System.Action<int> OnPhaseChanged; // phaseIndex
|
||||
public event System.Action<float> OnPhaseTransitionStart; // transitionDuration
|
||||
public event System.Action OnPhaseTransitionEnd;
|
||||
// 정적 이벤트 (UI 자동 연결용)
|
||||
/// <summary>
|
||||
/// 보스 스폰 시 발생하는 정적 이벤트
|
||||
@@ -60,13 +32,6 @@ namespace Colosseum.Enemy
|
||||
/// </summary>
|
||||
public static BossEnemy ActiveBoss { get; private set; }
|
||||
|
||||
// Properties
|
||||
public int CurrentPhaseIndex => currentPhaseIndex;
|
||||
public BossPhaseData CurrentPhase => phases.Count > currentPhaseIndex ? phases[currentPhaseIndex] : null;
|
||||
public int TotalPhases => phases.Count;
|
||||
public bool IsTransitioning => isTransitioning;
|
||||
public float PhaseElapsedTime => phaseElapsedTime;
|
||||
|
||||
public override void OnNetworkSpawn()
|
||||
{
|
||||
base.OnNetworkSpawn();
|
||||
@@ -78,15 +43,8 @@ namespace Colosseum.Enemy
|
||||
behaviorAgent = gameObject.AddComponent<BehaviorGraphAgent>();
|
||||
}
|
||||
|
||||
combatBehaviorContext = GetComponent<BossCombatBehaviorContext>();
|
||||
|
||||
// 초기 AI 설정
|
||||
if (IsServer && combatBehaviorContext != null && combatBehaviorContext.DisableBehaviorGraph)
|
||||
{
|
||||
behaviorAgent.enabled = false;
|
||||
behaviorAgent.Graph = null;
|
||||
}
|
||||
else if (IsServer && initialBehaviorGraph != null)
|
||||
if (IsServer && initialBehaviorGraph != null)
|
||||
{
|
||||
behaviorAgent.Graph = initialBehaviorGraph;
|
||||
}
|
||||
@@ -101,185 +59,12 @@ namespace Colosseum.Enemy
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected override void InitializeStats()
|
||||
{
|
||||
base.InitializeStats();
|
||||
phaseStartTime = Time.time;
|
||||
phaseElapsedTime = 0f;
|
||||
currentPhaseIndex = 0;
|
||||
isTransitioning = false;
|
||||
isInvincible = false;
|
||||
customConditions.Clear();
|
||||
}
|
||||
|
||||
protected override void OnServerUpdate()
|
||||
{
|
||||
if (isTransitioning) return;
|
||||
|
||||
phaseElapsedTime = Time.time - phaseStartTime;
|
||||
CheckPhaseTransition();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 페이즈 전환 조건 확인
|
||||
/// </summary>
|
||||
private void CheckPhaseTransition()
|
||||
{
|
||||
int nextPhaseIndex = currentPhaseIndex + 1;
|
||||
if (nextPhaseIndex >= phases.Count)
|
||||
return;
|
||||
|
||||
BossPhaseData nextPhase = phases[nextPhaseIndex];
|
||||
if (nextPhase == null)
|
||||
return;
|
||||
|
||||
if (nextPhase.CheckTransitionCondition(this, phaseElapsedTime))
|
||||
{
|
||||
StartPhaseTransition(nextPhaseIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 페이즈 전환 시작
|
||||
/// </summary>
|
||||
private void StartPhaseTransition(int newPhaseIndex)
|
||||
{
|
||||
if (newPhaseIndex >= phases.Count || isTransitioning)
|
||||
return;
|
||||
|
||||
isTransitioning = true;
|
||||
isInvincible = true;
|
||||
|
||||
StartCoroutine(PhaseTransitionCoroutine(newPhaseIndex));
|
||||
}
|
||||
|
||||
private System.Collections.IEnumerator PhaseTransitionCoroutine(int newPhaseIndex)
|
||||
{
|
||||
BossPhaseData newPhase = phases[newPhaseIndex];
|
||||
|
||||
// 전환 이벤트
|
||||
OnPhaseTransitionStart?.Invoke(phaseTransitionDuration);
|
||||
|
||||
// 전환 연출
|
||||
yield return PlayPhaseTransitionEffect(newPhase);
|
||||
|
||||
// AI 그래프 교체
|
||||
if (newPhase.BehaviorGraph != null && behaviorAgent != null)
|
||||
{
|
||||
behaviorAgent.End();
|
||||
behaviorAgent.Graph = newPhase.BehaviorGraph;
|
||||
}
|
||||
|
||||
// 페이즈 전환 완료
|
||||
currentPhaseIndex = newPhaseIndex;
|
||||
phaseStartTime = Time.time;
|
||||
phaseElapsedTime = 0f;
|
||||
|
||||
// 무적 해제
|
||||
yield return new WaitForSeconds(phaseTransitionInvincibilityTime);
|
||||
isInvincible = false;
|
||||
isTransitioning = false;
|
||||
|
||||
OnPhaseTransitionEnd?.Invoke();
|
||||
OnPhaseChanged?.Invoke(currentPhaseIndex);
|
||||
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log($"[Boss] Phase transition: {currentPhaseIndex} ({newPhase.PhaseName})");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 페이즈 전환 연출 재생
|
||||
/// </summary>
|
||||
private System.Collections.IEnumerator PlayPhaseTransitionEffect(BossPhaseData newPhase)
|
||||
{
|
||||
// 애니메이션 재생
|
||||
if (animator != null && newPhase.PhaseStartAnimation != null)
|
||||
{
|
||||
animator.Play(newPhase.PhaseStartAnimation.name);
|
||||
}
|
||||
|
||||
// 이펙트 생성
|
||||
if (newPhase.PhaseTransitionEffect != null)
|
||||
{
|
||||
var effect = Instantiate(newPhase.PhaseTransitionEffect, transform.position, transform.rotation);
|
||||
Destroy(effect, phaseTransitionDuration);
|
||||
}
|
||||
|
||||
// 전환 시간 대기
|
||||
yield return new WaitForSeconds(phaseTransitionDuration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 대미지 적용 (무적 상태 고려)
|
||||
/// </summary>
|
||||
public override float TakeDamage(float damage, object source = null)
|
||||
{
|
||||
if (isInvincible)
|
||||
return 0f;
|
||||
|
||||
return base.TakeDamage(damage, source);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 커스텀 조건 설정
|
||||
/// </summary>
|
||||
public void SetCustomCondition(string conditionId, bool value)
|
||||
{
|
||||
customConditions[conditionId] = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 커스텀 조건 확인
|
||||
/// </summary>
|
||||
public bool CheckCustomCondition(string conditionId)
|
||||
{
|
||||
return customConditions.TryGetValue(conditionId, out bool value) && value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 수동으로 페이즈 전환
|
||||
/// </summary>
|
||||
public void ForcePhaseTransition(int phaseIndex)
|
||||
{
|
||||
if (!IsServer)
|
||||
return;
|
||||
|
||||
if (phaseIndex >= 0 && phaseIndex < phases.Count && phaseIndex != currentPhaseIndex)
|
||||
{
|
||||
StartPhaseTransition(phaseIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 현재 페이즈 재시작
|
||||
/// </summary>
|
||||
public void RestartCurrentPhase()
|
||||
{
|
||||
if (!IsServer)
|
||||
return;
|
||||
|
||||
phaseStartTime = Time.time;
|
||||
phaseElapsedTime = 0f;
|
||||
|
||||
if (behaviorAgent != null)
|
||||
{
|
||||
behaviorAgent.Restart();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void HandleDeath()
|
||||
{
|
||||
// 마지막 페이즈에서만 사망 처리
|
||||
if (currentPhaseIndex < phases.Count - 1 && !isTransitioning)
|
||||
{
|
||||
// 아직 페이즈가 남아있으면 강제로 다음 페이즈로
|
||||
StartPhaseTransition(currentPhaseIndex + 1);
|
||||
return;
|
||||
}
|
||||
|
||||
// AI 완전 중단 (순서 중요: enabled=false를 먼저 호출하여 Update() 차단)
|
||||
if (behaviorAgent != null)
|
||||
{
|
||||
@@ -291,30 +76,5 @@ namespace Colosseum.Enemy
|
||||
|
||||
base.HandleDeath();
|
||||
}
|
||||
|
||||
#region Debug
|
||||
|
||||
private void OnDrawGizmosSelected()
|
||||
{
|
||||
if (!debugMode)
|
||||
return;
|
||||
|
||||
// 현재 페이즈 정보 표시
|
||||
#if UNITY_EDITOR
|
||||
if (phases != null && currentPhaseIndex < phases.Count)
|
||||
{
|
||||
var phase = phases[currentPhaseIndex];
|
||||
if (phase != null)
|
||||
{
|
||||
UnityEditor.Handles.Label(
|
||||
transform.position + Vector3.up * 3f,
|
||||
$"Phase {currentPhaseIndex + 1}/{phases.Count}\n{phase.PhaseName}"
|
||||
);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,11 +70,13 @@ namespace Colosseum.Enemy
|
||||
/// </summary>
|
||||
public bool CheckTransitionCondition(BossEnemy boss, float elapsedTime)
|
||||
{
|
||||
BossBehaviorRuntimeState context = boss != null ? boss.GetComponent<BossBehaviorRuntimeState>() : null;
|
||||
|
||||
return transitionType switch
|
||||
{
|
||||
PhaseTransitionType.HealthPercent => boss.CurrentHealth / boss.MaxHealth <= healthPercentThreshold,
|
||||
PhaseTransitionType.TimeElapsed => elapsedTime >= timeThreshold,
|
||||
PhaseTransitionType.CustomCondition => boss.CheckCustomCondition(customConditionId),
|
||||
PhaseTransitionType.CustomCondition => context != null && context.CheckPhaseCustomCondition(customConditionId),
|
||||
PhaseTransitionType.Manual => false,
|
||||
_ => false,
|
||||
};
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace Colosseum.Enemy
|
||||
{
|
||||
/// <summary>
|
||||
/// 드로그가 사용하는 보스 전투 컨텍스트 컴포넌트입니다.
|
||||
/// 현재는 공통 보스 전투 BT 프레임워크를 그대로 사용합니다.
|
||||
/// </summary>
|
||||
public class DrogPatternController : BossCombatBehaviorContext
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c5b2d4ef2f1b4ee49b5f7f2c7175fd10
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -286,6 +286,9 @@ namespace Colosseum.Enemy
|
||||
if (!IsServer || isDead.Value)
|
||||
return 0f;
|
||||
|
||||
if (ShouldIgnoreIncomingDamage(damage, source))
|
||||
return 0f;
|
||||
|
||||
float mitigatedDamage = ConsumeShield(damage);
|
||||
float actualDamage = Mathf.Min(mitigatedDamage, currentHealth.Value);
|
||||
currentHealth.Value = Mathf.Max(0f, currentHealth.Value - actualDamage);
|
||||
@@ -305,6 +308,14 @@ namespace Colosseum.Enemy
|
||||
return actualDamage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 하위 클래스가 특정 상태에서 피해를 무시해야 할 때 사용합니다.
|
||||
/// </summary>
|
||||
protected virtual bool ShouldIgnoreIncomingDamage(float damage, object source)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 대미지 피드백 (애니메이션, 이펙트)
|
||||
/// </summary>
|
||||
|
||||
@@ -28,6 +28,17 @@ namespace Colosseum.Skills
|
||||
Revive,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 마지막 스킬 실행 결과입니다.
|
||||
/// </summary>
|
||||
public enum SkillExecutionResult
|
||||
{
|
||||
None,
|
||||
Running,
|
||||
Completed,
|
||||
Cancelled,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 스킬 실행을 관리하는 컴포넌트.
|
||||
/// 애니메이션 이벤트 기반으로 효과가 발동됩니다.
|
||||
@@ -61,6 +72,8 @@ namespace Colosseum.Skills
|
||||
[SerializeField] private string lastCancelledSkillName = string.Empty;
|
||||
[Tooltip("마지막 강제 취소 이유")]
|
||||
[SerializeField] private SkillCancelReason lastCancelReason = SkillCancelReason.None;
|
||||
[Tooltip("마지막 스킬 실행 결과")]
|
||||
[SerializeField] private SkillExecutionResult lastExecutionResult = SkillExecutionResult.None;
|
||||
|
||||
// 현재 실행 중인 스킬
|
||||
private SkillData currentSkill;
|
||||
@@ -97,6 +110,7 @@ namespace Colosseum.Skills
|
||||
public Animator Animator => animator;
|
||||
public SkillCancelReason LastCancelReason => lastCancelReason;
|
||||
public string LastCancelledSkillName => lastCancelledSkillName;
|
||||
public SkillExecutionResult LastExecutionResult => lastExecutionResult;
|
||||
public GameObject CurrentTargetOverride => currentTargetOverride;
|
||||
public bool IsChannelingActive => isChannelingActive;
|
||||
|
||||
@@ -233,6 +247,8 @@ namespace Colosseum.Skills
|
||||
{
|
||||
if (currentSkill == null || animator == null) return;
|
||||
|
||||
UpdateCastTargetTracking();
|
||||
|
||||
// 채널링 중일 때
|
||||
if (isChannelingActive)
|
||||
{
|
||||
@@ -263,7 +279,7 @@ namespace Colosseum.Skills
|
||||
// 모든 클립과 반복이 끝나면 종료
|
||||
if (debugMode) Debug.Log($"[Skill] Animation complete: {currentSkill.SkillName}");
|
||||
RestoreBaseController();
|
||||
ClearCurrentSkillState();
|
||||
CompleteCurrentSkillExecution(SkillExecutionResult.Completed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,6 +291,14 @@ namespace Colosseum.Skills
|
||||
return ExecuteSkill(SkillLoadoutEntry.CreateTemporary(skill));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 타겟 오버라이드와 함께 스킬 시전
|
||||
/// </summary>
|
||||
public bool ExecuteSkill(SkillData skill, GameObject targetOverride)
|
||||
{
|
||||
return ExecuteSkill(SkillLoadoutEntry.CreateTemporary(skill), targetOverride);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 슬롯 엔트리 기준으로 스킬 시전
|
||||
/// </summary>
|
||||
@@ -340,6 +364,7 @@ namespace Colosseum.Skills
|
||||
currentLoadoutEntry = loadoutEntry != null ? loadoutEntry.CreateCopy() : SkillLoadoutEntry.CreateTemporary(skill);
|
||||
currentSkill = skill;
|
||||
lastCancelReason = SkillCancelReason.None;
|
||||
lastExecutionResult = SkillExecutionResult.Running;
|
||||
BuildResolvedEffects(currentLoadoutEntry);
|
||||
currentRepeatCount = currentLoadoutEntry.GetResolvedRepeatCount();
|
||||
currentIterationIndex = 0;
|
||||
@@ -706,7 +731,7 @@ namespace Colosseum.Skills
|
||||
Debug.Log($"[Skill] Cancelled: {currentSkill.SkillName} / reason={reason}");
|
||||
|
||||
RestoreBaseController();
|
||||
ClearCurrentSkillState();
|
||||
CompleteCurrentSkillExecution(SkillExecutionResult.Cancelled);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -945,7 +970,7 @@ namespace Colosseum.Skills
|
||||
Debug.Log($"[Skill] 채널링 종료: {currentSkill?.SkillName}");
|
||||
|
||||
RestoreBaseController();
|
||||
ClearCurrentSkillState();
|
||||
CompleteCurrentSkillExecution(SkillExecutionResult.Completed);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1023,6 +1048,65 @@ namespace Colosseum.Skills
|
||||
currentIterationIndex = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 현재 시전 중인 스킬을 지정 결과로 종료합니다.
|
||||
/// </summary>
|
||||
private void CompleteCurrentSkillExecution(SkillExecutionResult result)
|
||||
{
|
||||
lastExecutionResult = result;
|
||||
ClearCurrentSkillState();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 적 스킬이 시전 중일 때 대상 추적 정책을 적용합니다.
|
||||
/// </summary>
|
||||
private void UpdateCastTargetTracking()
|
||||
{
|
||||
if (currentSkill == null || currentTargetOverride == null || !currentTargetOverride.activeInHierarchy)
|
||||
return;
|
||||
|
||||
var enemyBase = GetComponent<Colosseum.Enemy.EnemyBase>();
|
||||
if (enemyBase == null)
|
||||
return;
|
||||
|
||||
if (IsSpawned && !IsServer)
|
||||
return;
|
||||
|
||||
Vector3 direction = currentTargetOverride.transform.position - transform.position;
|
||||
direction.y = 0f;
|
||||
if (direction.sqrMagnitude < 0.0001f)
|
||||
return;
|
||||
|
||||
if (currentSkill.CastTargetTrackingMode == SkillCastTargetTrackingMode.FaceTarget ||
|
||||
currentSkill.CastTargetTrackingMode == SkillCastTargetTrackingMode.MoveTowardTarget)
|
||||
{
|
||||
Quaternion targetRotation = Quaternion.LookRotation(direction.normalized);
|
||||
float rotationSpeed = Mathf.Max(0f, currentSkill.CastTargetRotationSpeed);
|
||||
if (rotationSpeed <= 0f)
|
||||
transform.rotation = targetRotation;
|
||||
else
|
||||
transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, rotationSpeed * 360f * Time.deltaTime);
|
||||
}
|
||||
|
||||
if (currentSkill.CastTargetTrackingMode != SkillCastTargetTrackingMode.MoveTowardTarget || currentSkill.UseRootMotion)
|
||||
return;
|
||||
|
||||
UnityEngine.AI.NavMeshAgent navMeshAgent = GetComponent<UnityEngine.AI.NavMeshAgent>();
|
||||
if (navMeshAgent == null || !navMeshAgent.enabled)
|
||||
return;
|
||||
|
||||
float stopDistance = Mathf.Max(0f, currentSkill.CastTargetStopDistance);
|
||||
if (direction.magnitude <= stopDistance)
|
||||
{
|
||||
navMeshAgent.isStopped = true;
|
||||
navMeshAgent.ResetPath();
|
||||
return;
|
||||
}
|
||||
|
||||
navMeshAgent.isStopped = false;
|
||||
navMeshAgent.SetDestination(currentTargetOverride.transform.position);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 현재 트리거 인덱스에 연결된 젬 이상상태를 적중 대상에게 적용합니다.
|
||||
/// </summary>
|
||||
|
||||
@@ -50,6 +50,16 @@ namespace Colosseum.Skills
|
||||
All = Instant | Buff,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 시전 중 대상 추적 방식입니다.
|
||||
/// </summary>
|
||||
public enum SkillCastTargetTrackingMode
|
||||
{
|
||||
None,
|
||||
FaceTarget,
|
||||
MoveTowardTarget,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 스킬 데이터. 스킬의 기본 정보와 효과 목록을 관리합니다.
|
||||
/// </summary>
|
||||
@@ -180,6 +190,14 @@ namespace Colosseum.Skills
|
||||
[Tooltip("시전 중 다른 스킬 입력 차단 여부")]
|
||||
[SerializeField] private bool blockOtherSkillsWhileCasting = true;
|
||||
|
||||
[Header("시전 중 대상 추적")]
|
||||
[Tooltip("시전 중 대상에게 얼마나 추종할지 결정합니다.")]
|
||||
[SerializeField] private SkillCastTargetTrackingMode castTargetTrackingMode = SkillCastTargetTrackingMode.None;
|
||||
[Tooltip("대상을 바라볼 때 사용하는 회전 속도입니다.")]
|
||||
[Min(0f)] [SerializeField] private float castTargetRotationSpeed = 12f;
|
||||
[Tooltip("대상을 추격할 때 멈추는 거리입니다.")]
|
||||
[Min(0f)] [SerializeField] private float castTargetStopDistance = 0f;
|
||||
|
||||
[Header("무기 조건")]
|
||||
[Tooltip("이 스킬 사용에 필요한 무기 특성. None이면 제약 없음.")]
|
||||
[SerializeField] private WeaponTrait allowedWeaponTraits = WeaponTrait.None;
|
||||
@@ -246,6 +264,9 @@ namespace Colosseum.Skills
|
||||
public bool BlockMovementWhileCasting => blockMovementWhileCasting;
|
||||
public bool BlockJumpWhileCasting => blockJumpWhileCasting;
|
||||
public bool BlockOtherSkillsWhileCasting => blockOtherSkillsWhileCasting;
|
||||
public SkillCastTargetTrackingMode CastTargetTrackingMode => castTargetTrackingMode;
|
||||
public float CastTargetRotationSpeed => castTargetRotationSpeed;
|
||||
public float CastTargetStopDistance => castTargetStopDistance;
|
||||
public IReadOnlyList<SkillEffect> CastStartEffects => castStartEffects;
|
||||
public IReadOnlyList<SkillTriggeredEffectEntry> TriggeredEffects => triggeredEffects;
|
||||
public WeaponTrait AllowedWeaponTraits => allowedWeaponTraits;
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Colosseum.UI
|
||||
private float targetHealthRatio;
|
||||
private bool isSubscribed;
|
||||
private bool isSubscribedToStaticEvent;
|
||||
private BossCombatBehaviorContext bossCombatContext;
|
||||
private BossBehaviorRuntimeState bossRuntimeState;
|
||||
private AbnormalityManager targetAbnormalityManager;
|
||||
|
||||
/// <summary>
|
||||
@@ -82,7 +82,7 @@ namespace Colosseum.UI
|
||||
// 초기 UI 업데이트
|
||||
if (targetBoss != null)
|
||||
{
|
||||
bossCombatContext = targetBoss.GetComponent<BossCombatBehaviorContext>();
|
||||
bossRuntimeState = targetBoss.GetComponent<BossBehaviorRuntimeState>();
|
||||
EnsureAbnormalitySummaryText();
|
||||
UpdateBossName();
|
||||
UpdateHealthImmediate();
|
||||
@@ -92,7 +92,7 @@ namespace Colosseum.UI
|
||||
}
|
||||
else
|
||||
{
|
||||
bossCombatContext = null;
|
||||
bossRuntimeState = null;
|
||||
if (abnormalitySummaryText != null)
|
||||
abnormalitySummaryText.text = string.Empty;
|
||||
SetSignatureVisible(false);
|
||||
@@ -161,7 +161,7 @@ namespace Colosseum.UI
|
||||
else if (targetBoss != null)
|
||||
{
|
||||
SubscribeToBoss();
|
||||
bossCombatContext = targetBoss.GetComponent<BossCombatBehaviorContext>();
|
||||
bossRuntimeState = targetBoss.GetComponent<BossBehaviorRuntimeState>();
|
||||
UpdateBossName();
|
||||
UpdateHealthImmediate();
|
||||
UpdateAbnormalitySummary();
|
||||
|
||||
@@ -384,15 +384,19 @@ namespace Colosseum.UI
|
||||
if (NoBoss || !IsHost) return;
|
||||
if (int.TryParse(phaseInputField.text, out int phase))
|
||||
{
|
||||
phase = Mathf.Clamp(phase, 0, Mathf.Max(0, cachedBoss.TotalPhases - 1));
|
||||
cachedBoss.ForcePhaseTransition(phase);
|
||||
BossBehaviorRuntimeState context = cachedBoss.GetComponent<BossBehaviorRuntimeState>();
|
||||
if (context == null)
|
||||
return;
|
||||
|
||||
phase = Mathf.Clamp(phase, 1, context.MaxPatternPhase);
|
||||
context.SetCurrentPatternPhase(phase);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnRestartPhase()
|
||||
{
|
||||
if (NoBoss || !IsHost) return;
|
||||
cachedBoss.RestartCurrentPhase();
|
||||
cachedBoss.GetComponent<BossBehaviorRuntimeState>()?.RestartCurrentPhaseTimer();
|
||||
}
|
||||
|
||||
private void OnRespawn()
|
||||
@@ -456,7 +460,7 @@ namespace Colosseum.UI
|
||||
/// <summary>
|
||||
/// 드롭다운을 갱신합니다.
|
||||
/// 에디터에서는 Data/Skills에서 보스 이름이 포함된 스킬을 모두 검색하고,
|
||||
/// 빌드에서는 패턴 슬롯의 스킬만 표시합니다.
|
||||
/// 빌드에서는 보스 강제 시전 드롭다운을 비웁니다.
|
||||
/// </summary>
|
||||
private void RebuildSkillDropdown()
|
||||
{
|
||||
@@ -476,7 +480,7 @@ namespace Colosseum.UI
|
||||
#if UNITY_EDITOR
|
||||
debugSkillList = LoadSkillsFromAssetFolder();
|
||||
#else
|
||||
debugSkillList = LoadSkillsFromPatternSlots();
|
||||
debugSkillList = null;
|
||||
#endif
|
||||
|
||||
if (debugSkillList == null || debugSkillList.Count == 0)
|
||||
@@ -524,18 +528,6 @@ namespace Colosseum.UI
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// 패턴 슬롯에서 고유 스킬을 수집합니다 (빌드용 fallback).
|
||||
/// </summary>
|
||||
private List<SkillData> LoadSkillsFromPatternSlots()
|
||||
{
|
||||
BossCombatBehaviorContext context = cachedBoss.GetComponent<BossCombatBehaviorContext>();
|
||||
if (context == null)
|
||||
return null;
|
||||
|
||||
return context.GetAllPatternSkills();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 드롭다운에서 선택한 스킬을 강제 발동합니다.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user