feat: 드로그 보스 AI 및 런타임 상태 구조 재구성
- 드로그 전투 컨텍스트를 BossBehaviorRuntimeState 중심 구조로 정리하고 BossEnemy, 패턴 액션, 조건 노드가 마지막 실행 결과와 phase 상태를 직접 사용하도록 갱신 - BT_Drog와 재빌드 에디터 스크립트를 확장해 phase 전환, 집행 결과 분기, 거리/쿨타임 기반 패턴 선택을 드로그 전용 자산과 노드 파라미터로 재구성 - 드로그 패턴/스킬/이펙트/애니메이션 플레이스홀더 자산을 재생성하고 보스 프리팹이 새 런타임 상태 및 등록 클립 구성을 참조하도록 정리
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user