Compare commits
2 Commits
0a0bc45209
...
3015aa3c22
| Author | SHA1 | Date | |
|---|---|---|---|
| 3015aa3c22 | |||
| e9e6257ad4 |
File diff suppressed because it is too large
Load Diff
@@ -13,12 +13,19 @@ MonoBehaviour:
|
||||
m_Name: "Data_Pattern_Drog_\uC9D1\uD589\uAC1C\uC2DC"
|
||||
m_EditorClassIdentifier: Colosseum.Game::Colosseum.AI.BossPatternData
|
||||
patternName: "\uC9D1\uD589\uAC1C\uC2DC"
|
||||
category: 1
|
||||
isSignature: 1
|
||||
steps:
|
||||
- Type: 2
|
||||
Skill: {fileID: 0}
|
||||
Duration: 3
|
||||
ChargeData:
|
||||
requiredDamageRatio: 0.1
|
||||
telegraphAbnormality: {fileID: 0}
|
||||
staggerDuration: 2
|
||||
- Type: 0
|
||||
Skill: {fileID: 11400000, guid: 99de24df2cb0464d9d4f633efde8dbdb, type: 2}
|
||||
Duration: 0
|
||||
- Type: 1
|
||||
Skill: {fileID: 0}
|
||||
Duration: 0
|
||||
ChargeData: {fileID: 0}
|
||||
cooldown: 45
|
||||
minPhase: 3
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
using Colosseum;
|
||||
using Colosseum.Abnormalities;
|
||||
using Colosseum.AI;
|
||||
using Colosseum.Combat;
|
||||
using Colosseum.Enemy;
|
||||
@@ -27,6 +27,7 @@ public abstract partial class BossPatternActionBase : Action
|
||||
protected SkillController skillController;
|
||||
protected BossCombatBehaviorContext combatBehaviorContext;
|
||||
protected UnityEngine.AI.NavMeshAgent navMeshAgent;
|
||||
protected AbnormalityManager abnormalityManager;
|
||||
|
||||
private BossPatternData activePattern;
|
||||
private GameObject activeTarget;
|
||||
@@ -34,6 +35,13 @@ public abstract partial class BossPatternActionBase : Action
|
||||
private bool isWaiting;
|
||||
private float waitEndTime;
|
||||
|
||||
private bool isChargeWaiting;
|
||||
private float chargeEndTime;
|
||||
private float chargeAccumulatedDamage;
|
||||
private float chargeRequiredDamage;
|
||||
private ChargeStepData activeChargeData;
|
||||
private bool chargeTelegraphApplied;
|
||||
|
||||
/// <summary>
|
||||
/// 액션 시작 시 실제로 실행할 패턴과 대상을 결정합니다.
|
||||
/// </summary>
|
||||
@@ -86,7 +94,23 @@ public abstract partial class BossPatternActionBase : Action
|
||||
if (bossEnemy.IsDead || bossEnemy.IsTransitioning)
|
||||
return Status.Failure;
|
||||
|
||||
if (isWaiting)
|
||||
if (isChargeWaiting)
|
||||
{
|
||||
if (chargeAccumulatedDamage >= chargeRequiredDamage)
|
||||
{
|
||||
EndChargeWait(broken: true);
|
||||
skillController?.CancelSkill(SkillCancelReason.Interrupt);
|
||||
LogDebug($"충전 차단 성공: 누적 {chargeAccumulatedDamage:F1} / 필요 {chargeRequiredDamage:F1}");
|
||||
CombatBalanceTracker.RecordBossEvent("집행 개시 차단 성공");
|
||||
return Status.Failure;
|
||||
}
|
||||
|
||||
if (Time.time < chargeEndTime)
|
||||
return Status.Running;
|
||||
|
||||
EndChargeWait(broken: false);
|
||||
}
|
||||
else if (isWaiting)
|
||||
{
|
||||
if (Time.time < waitEndTime)
|
||||
return Status.Running;
|
||||
@@ -132,8 +156,6 @@ public abstract partial class BossPatternActionBase : Action
|
||||
continue;
|
||||
|
||||
GameObject candidate = player.gameObject;
|
||||
if (Team.IsSameTeam(GameObject, candidate))
|
||||
continue;
|
||||
|
||||
float distance = Vector3.Distance(GameObject.transform.position, candidate.transform.position);
|
||||
if (distance > maxDistance || distance >= nearestDistance)
|
||||
@@ -164,7 +186,8 @@ public abstract partial class BossPatternActionBase : Action
|
||||
if (candidate == null || !candidate.activeInHierarchy)
|
||||
return false;
|
||||
|
||||
if (Team.IsSameTeam(GameObject, candidate))
|
||||
// 보스는 항상 적 팀이므로, 플레이어만 적대 대상으로 간주
|
||||
if (candidate.GetComponent<PlayerNetworkController>() == null)
|
||||
return false;
|
||||
|
||||
IDamageable damageable = candidate.GetComponent<IDamageable>();
|
||||
@@ -198,6 +221,12 @@ public abstract partial class BossPatternActionBase : Action
|
||||
return Status.Running;
|
||||
}
|
||||
|
||||
if (step.Type == PatternStepType.ChargeWait)
|
||||
{
|
||||
StartChargeWait(step);
|
||||
return Status.Running;
|
||||
}
|
||||
|
||||
if (step.Skill == null)
|
||||
{
|
||||
Debug.LogWarning($"[{GetType().Name}] 스킬이 비어 있는 패턴 스텝입니다: {activePattern.PatternName} / Step={currentStepIndex}");
|
||||
@@ -234,6 +263,68 @@ public abstract partial class BossPatternActionBase : Action
|
||||
return Status.Running;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 충전 대기를 시작합니다. 전조 이상상태를 부여하고 데미지 추적을 시작합니다.
|
||||
/// </summary>
|
||||
private void StartChargeWait(PatternStep step)
|
||||
{
|
||||
isChargeWaiting = true;
|
||||
activeChargeData = step.ChargeData;
|
||||
chargeEndTime = Time.time + step.Duration;
|
||||
chargeAccumulatedDamage = 0f;
|
||||
|
||||
float damageRatio = activeChargeData != null ? activeChargeData.RequiredDamageRatio : 0.1f;
|
||||
chargeRequiredDamage = bossEnemy.MaxHealth * damageRatio;
|
||||
chargeTelegraphApplied = false;
|
||||
|
||||
if (enemyBase != null)
|
||||
enemyBase.OnDamageTaken += OnChargeDamageTaken;
|
||||
|
||||
if (activeChargeData != null && activeChargeData.TelegraphAbnormality != null && abnormalityManager != null)
|
||||
{
|
||||
abnormalityManager.ApplyAbnormality(activeChargeData.TelegraphAbnormality, GameObject);
|
||||
chargeTelegraphApplied = true;
|
||||
}
|
||||
|
||||
LogDebug($"충전 대기 시작: 필요 피해={chargeRequiredDamage:F1} / 대기={step.Duration:F1}s");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 충전 대기를 종료합니다. 전조 이상상태를 제거하고 데미지 추적을 해제합니다.
|
||||
/// </summary>
|
||||
private void EndChargeWait(bool broken)
|
||||
{
|
||||
isChargeWaiting = false;
|
||||
|
||||
if (enemyBase != null)
|
||||
enemyBase.OnDamageTaken -= OnChargeDamageTaken;
|
||||
|
||||
if (chargeTelegraphApplied && abnormalityManager != null && activeChargeData != null
|
||||
&& activeChargeData.TelegraphAbnormality != null)
|
||||
{
|
||||
abnormalityManager.RemoveAbnormality(activeChargeData.TelegraphAbnormality);
|
||||
chargeTelegraphApplied = false;
|
||||
}
|
||||
|
||||
if (broken && activeChargeData != null)
|
||||
{
|
||||
combatBehaviorContext.LastChargeStaggerDuration = activeChargeData.StaggerDuration;
|
||||
}
|
||||
|
||||
activeChargeData = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 충전 중 보스가 받은 피해를 누적합니다.
|
||||
/// </summary>
|
||||
private void OnChargeDamageTaken(float damage)
|
||||
{
|
||||
if (!isChargeWaiting || damage <= 0f)
|
||||
return;
|
||||
|
||||
chargeAccumulatedDamage += damage;
|
||||
}
|
||||
|
||||
private bool IsReady()
|
||||
{
|
||||
return bossEnemy != null && enemyBase != null && skillController != null && combatBehaviorContext != null;
|
||||
@@ -255,10 +346,16 @@ public abstract partial class BossPatternActionBase : Action
|
||||
|
||||
if (navMeshAgent == null)
|
||||
navMeshAgent = GameObject.GetComponent<UnityEngine.AI.NavMeshAgent>();
|
||||
|
||||
if (abnormalityManager == null)
|
||||
abnormalityManager = GameObject.GetComponent<AbnormalityManager>();
|
||||
}
|
||||
|
||||
private void ClearRuntimeState()
|
||||
{
|
||||
if (isChargeWaiting)
|
||||
EndChargeWait(broken: false);
|
||||
|
||||
activePattern = null;
|
||||
activeTarget = null;
|
||||
currentStepIndex = 0;
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
|
||||
using Colosseum.Enemy;
|
||||
|
||||
using Unity.Behavior;
|
||||
using Unity.Properties;
|
||||
using UnityEngine;
|
||||
|
||||
using Action = Unity.Behavior.Action;
|
||||
|
||||
/// <summary>
|
||||
/// 보스를 경직시키는 BT 액션입니다.
|
||||
/// 충전 차단 성공 등의 상황에서 사용됩니다.
|
||||
/// 경직 시간은 BossCombatBehaviorContext.LastChargeStaggerDuration에서 읽습니다.
|
||||
/// </summary>
|
||||
[Serializable, GeneratePropertyBag]
|
||||
[NodeDescription(
|
||||
name: "Boss Stagger",
|
||||
story: "보스 경직",
|
||||
category: "Action",
|
||||
id: "d4e5f6a7-1111-2222-3333-888899990000")]
|
||||
public partial class BossStaggerAction : Action
|
||||
{
|
||||
private BossCombatBehaviorContext combatBehaviorContext;
|
||||
private BossEnemy bossEnemy;
|
||||
private EnemyBase enemyBase;
|
||||
private float staggerEndTime;
|
||||
|
||||
protected override Status OnStart()
|
||||
{
|
||||
combatBehaviorContext = GameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
bossEnemy = GameObject.GetComponent<BossEnemy>();
|
||||
enemyBase = GameObject.GetComponent<EnemyBase>();
|
||||
|
||||
if (combatBehaviorContext == null || bossEnemy == null)
|
||||
return Status.Failure;
|
||||
|
||||
float staggerDuration = combatBehaviorContext.LastChargeStaggerDuration;
|
||||
if (staggerDuration <= 0f)
|
||||
return Status.Success;
|
||||
|
||||
UnityEngine.AI.NavMeshAgent navMeshAgent = GameObject.GetComponent<UnityEngine.AI.NavMeshAgent>();
|
||||
if (navMeshAgent != null && navMeshAgent.enabled)
|
||||
{
|
||||
navMeshAgent.isStopped = true;
|
||||
navMeshAgent.ResetPath();
|
||||
}
|
||||
|
||||
if (enemyBase != null && enemyBase.Animator != null)
|
||||
{
|
||||
if (HasAnimatorParameter(enemyBase.Animator, "Hit"))
|
||||
enemyBase.Animator.SetTrigger("Hit");
|
||||
}
|
||||
|
||||
staggerEndTime = Time.time + staggerDuration;
|
||||
return Status.Running;
|
||||
}
|
||||
|
||||
protected override Status OnUpdate()
|
||||
{
|
||||
if (Time.time < staggerEndTime)
|
||||
return Status.Running;
|
||||
|
||||
return Status.Success;
|
||||
}
|
||||
|
||||
protected override void OnEnd()
|
||||
{
|
||||
staggerEndTime = 0f;
|
||||
}
|
||||
|
||||
private static bool HasAnimatorParameter(Animator animator, string parameterName)
|
||||
{
|
||||
if (animator == null || string.IsNullOrEmpty(parameterName))
|
||||
return false;
|
||||
|
||||
AnimatorControllerParameter[] parameters = animator.parameters;
|
||||
for (int i = 0; i < parameters.Length; i++)
|
||||
{
|
||||
AnimatorControllerParameter parameter = parameters[i];
|
||||
if (parameter.type == AnimatorControllerParameterType.Trigger && parameter.name == parameterName)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 062f28443a925e44388bea4cab192d47
|
||||
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
|
||||
using Colosseum.Abnormalities;
|
||||
using Colosseum.AI;
|
||||
using Colosseum.Combat;
|
||||
using Colosseum.Enemy;
|
||||
using Colosseum.Player;
|
||||
|
||||
using Unity.Behavior;
|
||||
using Unity.Properties;
|
||||
using UnityEngine;
|
||||
|
||||
using Action = Unity.Behavior.Action;
|
||||
|
||||
/// <summary>
|
||||
/// 충전 차단에 실패하여 패턴이 완료되었을 때, 전체 플레이어에게 범위 효과를 적용합니다.
|
||||
/// 기존 BossCombatBehaviorContext.ExecuteSignatureFailure()의 BT 노드 이관 버전입니다.
|
||||
/// </summary>
|
||||
[Serializable, GeneratePropertyBag]
|
||||
[NodeDescription(
|
||||
name: "Signature Failure Effects",
|
||||
story: "패턴 완료 범위 효과 적용",
|
||||
category: "Action",
|
||||
id: "c3d4e5f6-1111-2222-3333-777788889999")]
|
||||
public partial class SignatureFailureEffectsAction : Action
|
||||
{
|
||||
private BossCombatBehaviorContext combatBehaviorContext;
|
||||
|
||||
protected override Status OnStart()
|
||||
{
|
||||
combatBehaviorContext = GameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
if (combatBehaviorContext == null)
|
||||
{
|
||||
Debug.LogWarning("[SignatureFailureEffects] BossCombatBehaviorContext를 찾을 수 없습니다.");
|
||||
return Status.Failure;
|
||||
}
|
||||
|
||||
ApplyFailureEffects();
|
||||
return Status.Success;
|
||||
}
|
||||
|
||||
private void ApplyFailureEffects()
|
||||
{
|
||||
float failureDamage = combatBehaviorContext.SignatureFailureDamage;
|
||||
AbnormalityData failureAbnormality = combatBehaviorContext.SignatureFailureAbnormality;
|
||||
float knockbackRadius = combatBehaviorContext.SignatureFailureKnockbackRadius;
|
||||
float downRadius = combatBehaviorContext.SignatureFailureDownRadius;
|
||||
float knockbackSpeed = combatBehaviorContext.SignatureFailureKnockbackSpeed;
|
||||
float knockbackDuration = combatBehaviorContext.SignatureFailureKnockbackDuration;
|
||||
float downDuration = combatBehaviorContext.SignatureFailureDownDuration;
|
||||
|
||||
PlayerNetworkController[] players = UnityEngine.Object.FindObjectsByType<PlayerNetworkController>(FindObjectsSortMode.None);
|
||||
for (int i = 0; i < players.Length; i++)
|
||||
{
|
||||
PlayerNetworkController player = players[i];
|
||||
if (player == null || player.IsDead || !player.gameObject.activeInHierarchy)
|
||||
continue;
|
||||
|
||||
GameObject target = player.gameObject;
|
||||
if (!combatBehaviorContext.IsValidHostileTarget(target))
|
||||
continue;
|
||||
|
||||
player.TakeDamage(failureDamage, GameObject);
|
||||
|
||||
if (failureAbnormality != null)
|
||||
{
|
||||
AbnormalityManager targetAbnormalityManager = target.GetComponent<AbnormalityManager>();
|
||||
targetAbnormalityManager?.ApplyAbnormality(failureAbnormality, GameObject);
|
||||
}
|
||||
|
||||
HitReactionController hitReactionController = target.GetComponent<HitReactionController>();
|
||||
if (hitReactionController == null)
|
||||
continue;
|
||||
|
||||
float distance = Vector3.Distance(GameObject.transform.position, target.transform.position);
|
||||
if (distance <= downRadius)
|
||||
{
|
||||
hitReactionController.ApplyDown(downDuration);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (distance > knockbackRadius)
|
||||
continue;
|
||||
|
||||
Vector3 knockbackDirection = target.transform.position - GameObject.transform.position;
|
||||
knockbackDirection.y = 0f;
|
||||
if (knockbackDirection.sqrMagnitude < 0.0001f)
|
||||
{
|
||||
knockbackDirection = GameObject.transform.forward;
|
||||
}
|
||||
|
||||
hitReactionController.ApplyKnockback(knockbackDirection.normalized * knockbackSpeed, knockbackDuration);
|
||||
}
|
||||
|
||||
CombatBalanceTracker.RecordBossEvent("집행 개시 실패");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f7265ab9f84aaa546849b4e74c7bc669
|
||||
@@ -11,7 +11,8 @@ using UnityEngine;
|
||||
/// 지정된 패턴을 실행하는 범용 액션 노드입니다.
|
||||
/// Pattern 필드에 BossPatternData 에셋을 직접 할당합니다.
|
||||
/// 타겟 해석과 등록은 Condition에서 처리되므로, 이 액션은 순수하게 패턴만 실행합니다.
|
||||
/// 시그니처 패턴은 내부적으로 TryStartSignaturePattern 경로를 사용합니다.
|
||||
/// 시그니처 패턴도 일반 패턴과 동일하게 BossPatternActionBase의 스텝 루프로 실행됩니다.
|
||||
/// ChargeWait 스텝이 차단/완료 판정을 담당합니다.
|
||||
/// </summary>
|
||||
[Serializable, GeneratePropertyBag]
|
||||
[NodeDescription(
|
||||
@@ -25,20 +26,12 @@ public partial class UsePatternByRoleAction : BossPatternActionBase
|
||||
[Tooltip("실행할 패턴")]
|
||||
public BlackboardVariable<BossPatternData> Pattern;
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 패턴 실행 상태 추적
|
||||
/// </summary>
|
||||
private bool signatureStarted;
|
||||
|
||||
protected override Status OnStart()
|
||||
{
|
||||
BossPatternData pattern = Pattern?.Value;
|
||||
if (pattern == null)
|
||||
return Status.Failure;
|
||||
|
||||
if (pattern.IsSignature)
|
||||
return StartSignaturePattern();
|
||||
|
||||
// 타겟 해석은 ResolveStepTarget에서 처리됨
|
||||
// 여기서는 RegisterPatternUse만 호출 (근접 패턴 전용)
|
||||
if (pattern.IsMelee)
|
||||
@@ -53,58 +46,14 @@ public partial class UsePatternByRoleAction : BossPatternActionBase
|
||||
|
||||
protected override Status OnUpdate()
|
||||
{
|
||||
BossPatternData pattern = Pattern?.Value;
|
||||
if (pattern == null)
|
||||
return Status.Failure;
|
||||
|
||||
if (pattern.IsSignature)
|
||||
return UpdateSignaturePattern();
|
||||
|
||||
return base.OnUpdate();
|
||||
}
|
||||
|
||||
protected override void OnEnd()
|
||||
{
|
||||
if (signatureStarted)
|
||||
{
|
||||
signatureStarted = false;
|
||||
return;
|
||||
}
|
||||
|
||||
base.OnEnd();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 패턴 시작
|
||||
/// </summary>
|
||||
private Status StartSignaturePattern()
|
||||
{
|
||||
BossCombatBehaviorContext context = GameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
if (context == null)
|
||||
return Status.Failure;
|
||||
|
||||
GameObject target = Target != null ? Target.Value : null;
|
||||
signatureStarted = context.TryStartSignaturePattern(target);
|
||||
return signatureStarted ? Status.Running : Status.Failure;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 패턴 업데이트
|
||||
/// </summary>
|
||||
private Status UpdateSignaturePattern()
|
||||
{
|
||||
if (!signatureStarted)
|
||||
return Status.Failure;
|
||||
|
||||
BossCombatBehaviorContext context = GameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
if (context == null)
|
||||
return Status.Failure;
|
||||
|
||||
return context.IsSignaturePatternActive
|
||||
? Status.Running
|
||||
: Status.Success;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BossPatternActionBase.TryResolvePattern 구현.
|
||||
/// Condition에서 이미 타겟을 해석했으므로, Target.Value를 그대로 사용합니다.
|
||||
|
||||
@@ -19,9 +19,6 @@ namespace Colosseum.AI.BehaviorActions.Conditions
|
||||
if (pattern == null)
|
||||
return false;
|
||||
|
||||
if (pattern.IsSignature)
|
||||
return IsSignatureReady(gameObject);
|
||||
|
||||
BossCombatBehaviorContext context = gameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
if (context == null)
|
||||
return false;
|
||||
@@ -37,17 +34,5 @@ namespace Colosseum.AI.BehaviorActions.Conditions
|
||||
|
||||
return UsePatternAction.IsPatternReady(gameObject, pattern);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 패턴 전용 준비 여부 확인.
|
||||
/// </summary>
|
||||
private static bool IsSignatureReady(GameObject gameObject)
|
||||
{
|
||||
BossCombatBehaviorContext context = gameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
if (context == null)
|
||||
return false;
|
||||
|
||||
return context.IsSignaturePatternReady();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Colosseum.Abnormalities;
|
||||
using Colosseum.Skills;
|
||||
|
||||
namespace Colosseum.AI
|
||||
@@ -32,7 +34,33 @@ namespace Colosseum.AI
|
||||
Utility,
|
||||
}
|
||||
|
||||
public enum PatternStepType { Skill, Wait }
|
||||
public enum PatternStepType { Skill, Wait, ChargeWait }
|
||||
|
||||
/// <summary>
|
||||
/// ChargeWait 스텝의 차단 관련 설정 데이터입니다.
|
||||
/// 충전 대기 중 플레이어가 누적 피해를 충족하면 차단 성공으로 처리됩니다.
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class ChargeStepData
|
||||
{
|
||||
[Header("차단 조건")]
|
||||
[Tooltip("차단에 필요한 누적 피해 비율 (보스 최대 체력 기준)")]
|
||||
[Range(0f, 1f)]
|
||||
[SerializeField] private float requiredDamageRatio = 0.1f;
|
||||
|
||||
[Header("전조 효과")]
|
||||
[Tooltip("충전 중 부여할 전조 이상상태 (루핑 VFX 등)")]
|
||||
[SerializeField] private AbnormalityData telegraphAbnormality;
|
||||
|
||||
[Header("차단 성공 효과")]
|
||||
[Tooltip("차단 성공 시 보스 경직 시간")]
|
||||
[Min(0f)]
|
||||
[SerializeField] private float staggerDuration = 2f;
|
||||
|
||||
public float RequiredDamageRatio => requiredDamageRatio;
|
||||
public AbnormalityData TelegraphAbnormality => telegraphAbnormality;
|
||||
public float StaggerDuration => staggerDuration;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class PatternStep
|
||||
@@ -40,6 +68,9 @@ namespace Colosseum.AI
|
||||
public PatternStepType Type = PatternStepType.Skill;
|
||||
public SkillData Skill;
|
||||
[Min(0f)] public float Duration = 0.5f;
|
||||
|
||||
[Tooltip("ChargeWait 타입 전용 차단 설정")]
|
||||
public ChargeStepData ChargeData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -54,7 +85,7 @@ namespace Colosseum.AI
|
||||
[Header("패턴 특성")]
|
||||
[Tooltip("패턴 분류 — grace period 판단에 사용")]
|
||||
[SerializeField] private PatternCategory category = PatternCategory.Basic;
|
||||
[Tooltip("시그니처 패턴 여부 — 전용 실행 경로 사용")]
|
||||
[Tooltip("시그니처 패턴 여부 — 현재 사용되지 않음 (ChargeWait 스텝으로 대체)")]
|
||||
[SerializeField] private bool isSignature;
|
||||
[Tooltip("근접 패턴 여부 — meleePatternCounter 갱신")]
|
||||
[SerializeField] private bool isMelee;
|
||||
|
||||
441
Assets/_Game/Scripts/Editor/AnimationSectionSpeedEditor.cs
Normal file
441
Assets/_Game/Scripts/Editor/AnimationSectionSpeedEditor.cs
Normal file
@@ -0,0 +1,441 @@
|
||||
using UnityEngine;
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
/// <summary>
|
||||
/// 애니메이션 클립의 특정 프레임 구간 재생 속도를 조절하는 에디터 윈도우입니다.
|
||||
/// 지정한 프레임 범위의 키프레임 간격을 늘리거나 줄여 특정 동작을 강조할 수 있습니다.
|
||||
///
|
||||
/// 사용법:
|
||||
/// 1. Tools → Animation Section Speed Editor 열기
|
||||
/// 2. Project 창에서 .anim 파일 선택 (FBX 내부 클립은 Extract 후 사용)
|
||||
/// 3. 프레임 범위와 속도 배율 설정
|
||||
/// 4. Apply 클릭
|
||||
///
|
||||
/// ※ AssetDatabase.ImportAsset()을 호출하지 않고 AnimationUtility API로 메모리에서 수정 후
|
||||
/// SetDirty + SaveAssets로 저장합니다. Model Importer 파이프라인을 우회하여
|
||||
/// FBX 전체 타임라인이 끌려오는 문제를 방지합니다.
|
||||
/// </summary>
|
||||
public class AnimationSectionSpeedEditor : EditorWindow
|
||||
{
|
||||
[MenuItem("Tools/Animation Section Speed Editor")]
|
||||
public static void ShowWindow()
|
||||
{
|
||||
GetWindow<AnimationSectionSpeedEditor>("Section Speed Editor");
|
||||
}
|
||||
|
||||
private AnimationClip clip;
|
||||
private int fps = 30;
|
||||
private int startFrame;
|
||||
private int endFrame = 10;
|
||||
private float speedMultiplier = 1f;
|
||||
private Vector2 scrollPos;
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
|
||||
|
||||
// ── 클립 선택 ──
|
||||
EditorGUI.BeginChangeCheck();
|
||||
clip = (AnimationClip)EditorGUILayout.ObjectField("Animation Clip", clip, typeof(AnimationClip), false);
|
||||
if (EditorGUI.EndChangeCheck() && clip != null)
|
||||
{
|
||||
endFrame = Mathf.FloorToInt(clip.length * fps);
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
if (clip == null)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Animation Clip을 선택하세요.\n(FBX 내부 클립은 미리 Extract 해야 합니다)", MessageType.Info);
|
||||
EditorGUILayout.EndScrollView();
|
||||
return;
|
||||
}
|
||||
|
||||
// ── 클립 정보 (실제 키프레임 기반) ──
|
||||
float actualLength = GetActualLastKeyframeTime(clip);
|
||||
EditorGUILayout.LabelField("Clip Info", EditorStyles.boldLabel);
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.LabelField("Length (keyframes)", $"{actualLength:F3}s");
|
||||
EditorGUILayout.LabelField("m_StopTime", $"{clip.length:F3}s");
|
||||
|
||||
if (Mathf.Abs(clip.length - actualLength) > 0.01f)
|
||||
{
|
||||
EditorGUILayout.HelpBox($"m_StopTime({clip.length:F3}s)이 실제 키프레임 길이({actualLength:F3}s)와 다릅니다.\n" +
|
||||
"스피드 변경 시 실제 키프레임 길이를 기준으로 계산합니다.", MessageType.Warning);
|
||||
}
|
||||
|
||||
EditorGUILayout.LabelField("Total Frames ({fps}fps)", $"{Mathf.Max(1, Mathf.FloorToInt(actualLength * fps))}");
|
||||
EditorGUI.indentLevel--;
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
// ── FPS 설정 ──
|
||||
fps = EditorGUILayout.IntField("FPS", fps);
|
||||
fps = Mathf.Max(1, fps);
|
||||
|
||||
int totalFrames = Mathf.Max(1, Mathf.FloorToInt(actualLength * fps));
|
||||
|
||||
// ── 프레임 범위 ──
|
||||
EditorGUILayout.LabelField("Target Frame Range", EditorStyles.boldLabel);
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
int newStart = EditorGUILayout.IntField("Start Frame", startFrame);
|
||||
int newEnd = EditorGUILayout.IntField("End Frame", endFrame);
|
||||
|
||||
startFrame = Mathf.Clamp(newStart, 0, totalFrames - 1);
|
||||
endFrame = Mathf.Clamp(newEnd, 0, totalFrames);
|
||||
|
||||
// 슬라이더
|
||||
float startFloat = startFrame;
|
||||
float endFloat = endFrame;
|
||||
EditorGUILayout.MinMaxSlider(ref startFloat, ref endFloat, 0, totalFrames);
|
||||
startFrame = Mathf.RoundToInt(startFloat);
|
||||
endFrame = Mathf.RoundToInt(endFloat);
|
||||
EditorGUI.indentLevel--;
|
||||
|
||||
if (startFrame >= endFrame)
|
||||
{
|
||||
EditorGUILayout.HelpBox("시작 프레임이 끝 프레임보다 크거나 같습니다.", MessageType.Warning);
|
||||
EditorGUILayout.EndScrollView();
|
||||
return;
|
||||
}
|
||||
|
||||
float startTime = (float)startFrame / fps;
|
||||
float endTime = (float)endFrame / fps;
|
||||
float duration = endTime - startTime;
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
// ── 타임라인 시각화 ──
|
||||
DrawTimeline(startTime, endTime, actualLength);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
// ── 속도 배율 ──
|
||||
EditorGUILayout.LabelField("Speed", EditorStyles.boldLabel);
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
speedMultiplier = EditorGUILayout.FloatField("Speed Multiplier", speedMultiplier);
|
||||
speedMultiplier = Mathf.Max(0.1f, speedMultiplier);
|
||||
|
||||
// 프리셋 버튼
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("0.25x")) speedMultiplier = 0.25f;
|
||||
if (GUILayout.Button("0.5x")) speedMultiplier = 0.5f;
|
||||
if (GUILayout.Button("1.0x")) speedMultiplier = 1f;
|
||||
if (GUILayout.Button("2.0x")) speedMultiplier = 2f;
|
||||
EditorGUILayout.EndHorizontal();
|
||||
EditorGUI.indentLevel--;
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
// ── 미리보기 ──
|
||||
float newDuration = duration / speedMultiplier;
|
||||
float timeDelta = newDuration - duration;
|
||||
float newLength = actualLength + timeDelta;
|
||||
|
||||
EditorGUILayout.LabelField("Preview", EditorStyles.boldLabel);
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
EditorGUIUtility.labelWidth = 160;
|
||||
EditorGUILayout.LabelField("Original Section", $"{duration:F3}s (frame {startFrame}~{endFrame})");
|
||||
EditorGUILayout.LabelField("New Section", $"{newDuration:F3}s");
|
||||
EditorGUILayout.LabelField("Time Delta", $"{(timeDelta >= 0 ? "+" : "")}{timeDelta:F3}s");
|
||||
EditorGUILayout.LabelField("New Clip Length", $"{newLength:F3}s");
|
||||
EditorGUIUtility.labelWidth = 0;
|
||||
EditorGUI.indentLevel--;
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
// ── 적용 버튼 ──
|
||||
if (speedMultiplier == 1f)
|
||||
{
|
||||
EditorGUILayout.HelpBox("속도 배율이 1.0이면 변경 사항이 없습니다.", MessageType.Info);
|
||||
}
|
||||
|
||||
EditorGUI.BeginDisabledGroup(speedMultiplier == 1f);
|
||||
if (GUILayout.Button("Apply", GUILayout.Height(40)))
|
||||
{
|
||||
ApplySpeedChange();
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
EditorGUILayout.EndScrollView();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 타임라인을 간단한 바 형태로 시각화합니다.
|
||||
/// </summary>
|
||||
private void DrawTimeline(float startTime, float endTime, float clipLength)
|
||||
{
|
||||
float barHeight = 24f;
|
||||
float padding = 4f;
|
||||
Rect barRect = GUILayoutUtility.GetRect(EditorGUIUtility.currentViewWidth - 20, barHeight * 2 + padding * 3);
|
||||
|
||||
// 전체 타임라인 배경
|
||||
EditorGUI.DrawRect(barRect, new Color(0.2f, 0.2f, 0.2f, 1f));
|
||||
|
||||
float startNorm = Mathf.Clamp01(startTime / clipLength);
|
||||
float endNorm = Mathf.Clamp01(endTime / clipLength);
|
||||
|
||||
// ── 원본 구간 (위쪽 바) ──
|
||||
float topY = barRect.y + padding;
|
||||
Rect origSectionRect = new Rect(
|
||||
barRect.x + barRect.width * startNorm,
|
||||
topY,
|
||||
barRect.width * (endNorm - startNorm),
|
||||
barHeight);
|
||||
EditorGUI.DrawRect(origSectionRect, new Color(1f, 0.5f, 0.2f, 0.8f));
|
||||
|
||||
// 원본 구간 레이블
|
||||
GUIStyle labelStyle = new GUIStyle(EditorStyles.miniLabel);
|
||||
labelStyle.alignment = TextAnchor.MiddleCenter;
|
||||
labelStyle.normal.textColor = Color.white;
|
||||
EditorGUI.LabelField(origSectionRect, $"Original ({startFrame}~{endFrame})", labelStyle);
|
||||
|
||||
// ── 변경 후 구간 (아래쪽 바) ──
|
||||
float newDuration = (endTime - startTime) / speedMultiplier;
|
||||
float newClipLength = clipLength + (newDuration - (endTime - startTime));
|
||||
float newEndNorm = Mathf.Clamp01((startTime + newDuration) / newClipLength);
|
||||
|
||||
float botY = topY + barHeight + padding;
|
||||
Rect newSectionRect = new Rect(
|
||||
barRect.x + barRect.width * startNorm,
|
||||
botY,
|
||||
barRect.width * (newEndNorm - startNorm),
|
||||
barHeight);
|
||||
EditorGUI.DrawRect(newSectionRect, new Color(0.2f, 0.8f, 0.4f, 0.8f));
|
||||
|
||||
EditorGUI.LabelField(newSectionRect, $"New ({speedMultiplier}x)", labelStyle);
|
||||
|
||||
// 바 테두리
|
||||
EditorGUI.DrawRect(barRect, new Color(0.4f, 0.4f, 0.4f, 1f));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 본 트랜스폼 커브에서 실제 마지막 키프레임 시간을 구합니다.
|
||||
/// clip.length는 m_StopTime 기반이라 FBX Extract 클립에서는 실제 데이터와 다를 수 있습니다.
|
||||
/// IK 커브나 모션 플로트 커브는 제외하고, 본의 m_LocalRotation/Position/Scale만 참조합니다.
|
||||
/// </summary>
|
||||
private static readonly string[] BoneTransformProperties =
|
||||
{
|
||||
"m_LocalRotation.x", "m_LocalRotation.y", "m_LocalRotation.z", "m_LocalRotation.w",
|
||||
"m_LocalPosition.x", "m_LocalPosition.y", "m_LocalPosition.z",
|
||||
"m_LocalScale.x", "m_LocalScale.y", "m_LocalScale.z",
|
||||
"localEulerAnglesRaw.x", "localEulerAnglesRaw.y", "localEulerAnglesRaw.z",
|
||||
};
|
||||
|
||||
private static float GetActualLastKeyframeTime(AnimationClip clip)
|
||||
{
|
||||
float maxTime = 0f;
|
||||
EditorCurveBinding[] bindings = AnimationUtility.GetCurveBindings(clip);
|
||||
foreach (EditorCurveBinding binding in bindings)
|
||||
{
|
||||
// 모션 플로트 커브: path가 "0"이면 Humanoid muscle curve → 건너뛰기
|
||||
if (binding.path == "0")
|
||||
continue;
|
||||
|
||||
// 본 트랜스폼 프로퍼티만 참조 (IK 커브 등 제외)
|
||||
bool isBoneTransform = false;
|
||||
for (int i = 0; i < BoneTransformProperties.Length; i++)
|
||||
{
|
||||
if (binding.propertyName == BoneTransformProperties[i])
|
||||
{
|
||||
isBoneTransform = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isBoneTransform)
|
||||
continue;
|
||||
|
||||
AnimationCurve curve = AnimationUtility.GetEditorCurve(clip, binding);
|
||||
if (curve == null || curve.length == 0) continue;
|
||||
|
||||
float lastTime = curve.keys[curve.length - 1].time;
|
||||
if (lastTime > maxTime)
|
||||
maxTime = lastTime;
|
||||
}
|
||||
|
||||
// 이벤트도 고려
|
||||
AnimationEvent[] events = AnimationUtility.GetAnimationEvents(clip);
|
||||
foreach (var evt in events)
|
||||
{
|
||||
if (evt.time > maxTime)
|
||||
maxTime = evt.time;
|
||||
}
|
||||
|
||||
return maxTime;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Humanoid muscle curve인지 확인합니다. path가 "0"이면 Humanoid muscle curve입니다.
|
||||
/// bone transform, IK, prop, eyeLight 모두 수정 대상에 포함합니다.
|
||||
/// </summary>
|
||||
private static bool IsHumanoidMuscleCurve(string path)
|
||||
{
|
||||
return path == "0";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// AnimationUtility API를 사용하여 메모리에서 특정 구간의 재생 속도를 조절합니다.
|
||||
/// AssetDatabase.ImportAsset()을 호출하지 않으므로 Model Importer 파이프라인을 우회합니다.
|
||||
///
|
||||
/// 처리 순서:
|
||||
/// 1. AnimationUtility.GetAllCurves로 모든 커브를 가져옴
|
||||
/// 2. 본 경로(IsBonePath) 필터링
|
||||
/// 3. 대상 구간 내 키프레임 시간 재배열 + 접선 스케일링
|
||||
/// 4. 대상 구간 외 후속 키프레임 시간 이동
|
||||
/// 5. AnimationUtility.SetEditorCurve로 커브 덮어쓰기
|
||||
/// 6. SerializedObject로 m_StopTime 갱신
|
||||
/// 7. AnimationEvent 시간 이동
|
||||
/// 8. SetDirty + SaveAssets (ImportAsset 호출 금지)
|
||||
/// </summary>
|
||||
private void ApplySpeedChange()
|
||||
{
|
||||
if (clip == null) return;
|
||||
|
||||
float startTime = (float)startFrame / fps;
|
||||
float endTime = (float)endFrame / fps;
|
||||
float duration = endTime - startTime;
|
||||
float newDuration = duration / speedMultiplier;
|
||||
float timeDelta = newDuration - duration;
|
||||
float actualLength = GetActualLastKeyframeTime(clip);
|
||||
|
||||
Undo.RegisterCompleteObjectUndo(clip, $"Section Speed {speedMultiplier}x (frames {startFrame}~{endFrame})");
|
||||
|
||||
// ── 1. 모든 커브 가져오기 ──
|
||||
EditorCurveBinding[] bindings = AnimationUtility.GetCurveBindings(clip);
|
||||
AnimationCurve[] curves = new AnimationCurve[bindings.Length];
|
||||
for (int i = 0; i < bindings.Length; i++)
|
||||
{
|
||||
curves[i] = AnimationUtility.GetEditorCurve(clip, bindings[i]);
|
||||
}
|
||||
|
||||
int modifiedCurves = 0;
|
||||
int modifiedKeyframes = 0;
|
||||
int skippedCurves = 0;
|
||||
|
||||
// ── 2~4. 커브별 키프레임 시간 수정 ──
|
||||
for (int i = 0; i < bindings.Length; i++)
|
||||
{
|
||||
EditorCurveBinding binding = bindings[i];
|
||||
AnimationCurve curve = curves[i];
|
||||
|
||||
// Humanoid muscle curve만 건너뛰기 (IK, prop, eyeLight 모두 수정 대상)
|
||||
if (IsHumanoidMuscleCurve(binding.path))
|
||||
{
|
||||
skippedCurves++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (curve == null || curve.length == 0)
|
||||
continue;
|
||||
|
||||
// 새 키프레임 배열 생성
|
||||
Keyframe[] newKeys = new Keyframe[curve.length];
|
||||
bool anyModified = false;
|
||||
|
||||
for (int k = 0; k < curve.length; k++)
|
||||
{
|
||||
Keyframe oldKey = curve.keys[k];
|
||||
float t = oldKey.time;
|
||||
|
||||
if (t >= startTime - 0.0001f && t <= endTime + 0.0001f)
|
||||
{
|
||||
// 구간 내 키프레임: 시간 재배열 + 접선 스케일링
|
||||
float normalizedPos = (t - startTime) / duration;
|
||||
float newTime = startTime + normalizedPos * newDuration;
|
||||
|
||||
// 접선 스케일링: 시간축이 늘어나면 기울기는 줄어야 함
|
||||
// dy/dt' = dy/dt * speedMultiplier (t' = t/speedMultiplier 이므로)
|
||||
float tangentScale = speedMultiplier;
|
||||
|
||||
newKeys[k] = new Keyframe(
|
||||
newTime,
|
||||
oldKey.value,
|
||||
oldKey.inTangent * tangentScale,
|
||||
oldKey.outTangent * tangentScale,
|
||||
oldKey.inWeight,
|
||||
oldKey.outWeight);
|
||||
|
||||
anyModified = true;
|
||||
modifiedKeyframes++;
|
||||
}
|
||||
else if (t > endTime + 0.0001f)
|
||||
{
|
||||
// 구간 이후 키프레임: 시간만 이동 (접선은 그대로)
|
||||
newKeys[k] = new Keyframe(
|
||||
t + timeDelta,
|
||||
oldKey.value,
|
||||
oldKey.inTangent,
|
||||
oldKey.outTangent,
|
||||
oldKey.inWeight,
|
||||
oldKey.outWeight);
|
||||
|
||||
anyModified = true;
|
||||
modifiedKeyframes++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 구간 이전 키프레임: 그대로
|
||||
newKeys[k] = oldKey;
|
||||
}
|
||||
}
|
||||
|
||||
if (anyModified)
|
||||
{
|
||||
curves[i] = new AnimationCurve(newKeys);
|
||||
AnimationUtility.SetEditorCurve(clip, binding, curves[i]);
|
||||
modifiedCurves++;
|
||||
}
|
||||
}
|
||||
|
||||
// ── 5. m_StopTime 갱신 (SerializedObject로) ──
|
||||
float newStopTime = actualLength + timeDelta;
|
||||
var serializedClip = new SerializedObject(clip);
|
||||
SerializedProperty stopTimeProp = serializedClip.FindProperty("m_StopTime");
|
||||
if (stopTimeProp != null)
|
||||
{
|
||||
stopTimeProp.floatValue = newStopTime;
|
||||
serializedClip.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
// ── 6. AnimationEvent 시간 이동 ──
|
||||
AnimationEvent[] events = AnimationUtility.GetAnimationEvents(clip);
|
||||
bool eventsModified = false;
|
||||
for (int i = 0; i < events.Length; i++)
|
||||
{
|
||||
float evtTime = events[i].time;
|
||||
|
||||
if (evtTime >= startTime - 0.0001f && evtTime <= endTime + 0.0001f)
|
||||
{
|
||||
float normalizedPos = (evtTime - startTime) / duration;
|
||||
events[i].time = startTime + normalizedPos * newDuration;
|
||||
eventsModified = true;
|
||||
}
|
||||
else if (evtTime > endTime + 0.0001f)
|
||||
{
|
||||
events[i].time = evtTime + timeDelta;
|
||||
eventsModified = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (eventsModified)
|
||||
{
|
||||
AnimationUtility.SetAnimationEvents(clip, events);
|
||||
}
|
||||
|
||||
// ── 7. 저장 (ImportAsset 호출 금지) ──
|
||||
EditorUtility.SetDirty(clip);
|
||||
AssetDatabase.SaveAssets();
|
||||
Repaint();
|
||||
|
||||
Debug.Log($"[SectionSpeedEditor] {clip.name}: frames {startFrame}~{endFrame} → {speedMultiplier}x " +
|
||||
$"({duration:F3}s → {newDuration:F3}s) " +
|
||||
$"| clip: {actualLength:F3}s → {newStopTime:F3}s " +
|
||||
$"| curves: {modifiedCurves}, keyframes: {modifiedKeyframes}, skipped: {skippedCurves}" +
|
||||
$" | events: {(eventsModified ? "modified" : "none")}");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 11af7b19aec6eff43b6fa837908b7fe6
|
||||
@@ -522,56 +522,6 @@ namespace Colosseum.Editor
|
||||
Debug.Log($"[Debug] 보스를 Phase 2로 강제 전환했습니다. | Target={bossEnemy.name}");
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Colosseum/Debug/Force Boss Signature")]
|
||||
private static void ForceBossSignature()
|
||||
{
|
||||
if (!EditorApplication.isPlaying)
|
||||
{
|
||||
Debug.LogWarning("[Debug] 플레이 모드에서만 사용할 수 있습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
BossCombatBehaviorContext context = FindBossCombatContext();
|
||||
if (context == null)
|
||||
{
|
||||
Debug.LogWarning("[Debug] 보스 전투 컨텍스트를 찾지 못했습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!context.ForceStartSignaturePattern())
|
||||
{
|
||||
Debug.LogWarning("[Debug] 집행 개시를 강제로 시작하지 못했습니다. 이미 실행 중이거나 패턴이 비어 있을 수 있습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Log($"[Debug] 집행 개시를 강제로 시작했습니다. | Target={context.gameObject.name}");
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Colosseum/Debug/Preview Boss Signature Telegraph")]
|
||||
private static void PreviewBossSignatureTelegraph()
|
||||
{
|
||||
if (!EditorApplication.isPlaying)
|
||||
{
|
||||
Debug.LogWarning("[Debug] 플레이 모드에서만 사용할 수 있습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
BossCombatBehaviorContext context = FindBossCombatContext();
|
||||
if (context == null)
|
||||
{
|
||||
Debug.LogWarning("[Debug] 보스 전투 컨텍스트를 찾지 못했습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!context.PreviewSignatureTelegraph())
|
||||
{
|
||||
Debug.LogWarning("[Debug] 집행 개시 전조 프리뷰를 시작하지 못했습니다. 이미 다른 스킬이 재생 중일 수 있습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Log($"[Debug] 집행 개시 전조 프리뷰를 재생했습니다. | Target={context.gameObject.name}");
|
||||
}
|
||||
|
||||
private static void ApplyBossShieldWithType(string assetPath, float amount, float duration)
|
||||
{
|
||||
if (!EditorApplication.isPlaying)
|
||||
|
||||
@@ -259,15 +259,45 @@ namespace Colosseum.Editor
|
||||
SetNodeFieldValue(leapUseNode, "Pattern", mobilityPattern, setFieldValueMethod);
|
||||
LinkTarget(leapUseNode, targetVariable);
|
||||
|
||||
// #3 Signature — 집행 개시
|
||||
// #3 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));
|
||||
AttachPatternReadyCondition(signatureBranch, signaturePattern, authoringAssembly);
|
||||
AttachPhaseConditionIfNeeded(signatureBranch, signaturePattern, authoringAssembly);
|
||||
SetBranchRequiresAll(signatureBranch, true);
|
||||
object signatureUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UsePatternByRoleAction), new Vector2(branchX + actionOffsetX, startY + stepY * 2 + actionOffsetY));
|
||||
|
||||
// Sequence: 패턴 실행 → 결과 분기
|
||||
object signatureSequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod,
|
||||
runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true),
|
||||
new Vector2(branchX + 220f, startY + stepY * 2));
|
||||
|
||||
// Child 1: 집행개시 패턴 실행
|
||||
object signatureUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UsePatternByRoleAction), new Vector2(branchX + 400f, startY + stepY * 2));
|
||||
SetNodeFieldValue(signatureUseNode, "Pattern", signaturePattern, 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));
|
||||
|
||||
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));
|
||||
|
||||
// outcomeBranch True → 실패 효과 (충전 완료 = 플레이어들이 차단 실패)
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, outcomeBranch, "True", failureEffectsNode);
|
||||
// outcomeBranch False → 보스 경직 (차단 성공)
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, outcomeBranch, "False", staggerNode);
|
||||
|
||||
// Sequence에 자식 연결
|
||||
ConnectChildren(graphAsset, connectEdgeMethod, signatureSequence, signatureUseNode, outcomeBranch);
|
||||
|
||||
// 메인 체인: signatureBranch.True → Sequence
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, signatureBranch, "True", signatureSequence);
|
||||
|
||||
// #4 Combo — 콤보 패턴 + 조건부 도약 (Sequence)
|
||||
// comboBranch.True → Sequence:
|
||||
// Child 1: 연타2-강타 실행
|
||||
@@ -339,7 +369,7 @@ namespace Colosseum.Editor
|
||||
// ── FloatingPortNodeModel 생성 + 위치 보정 ──
|
||||
// Branch 노드의 NamedPort(True/False)에 대해 FloatingPortNodeModel을 생성합니다.
|
||||
// CreateNodePortsForNode는 기본 위치(Branch + 200px Y)를 사용하므로, 생성 후 사용자 조정 기준 위치로 이동합니다.
|
||||
var allBranches = new List<object> { downBranch, leapBranch, signatureBranch };
|
||||
var allBranches = new List<object> { downBranch, leapBranch, signatureBranch, outcomeBranch };
|
||||
if (comboBranch != null) allBranches.Add(comboBranch);
|
||||
allBranches.AddRange(new[] { primaryBranch, utilityBranch });
|
||||
foreach (object branch in allBranches)
|
||||
@@ -366,10 +396,10 @@ namespace Colosseum.Editor
|
||||
Connect(graphAsset, connectEdgeMethod, GetDefaultOutputPort(startNode), GetDefaultInputPort(repeatNode));
|
||||
Connect(graphAsset, connectEdgeMethod, GetDefaultOutputPort(repeatNode), GetDefaultInputPort(downBranch));
|
||||
|
||||
// 각 Branch의 True FloatingPort → Action (combo는 내부에서 Sequence로 연결됨)
|
||||
// 각 Branch의 True FloatingPort → Action (combo, signature는 내부에서 Sequence로 연결됨)
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, downBranch, "True", downUseNode);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, leapBranch, "True", leapUseNode);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, signatureBranch, "True", signatureUseNode);
|
||||
// signatureBranch.True는 signatureSequence에 이미 연결됨
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, primaryBranch, "True", primaryUseNode);
|
||||
ConnectBranch(graphAsset, connectEdgeMethod, utilityBranch, "True", utilityUseNode);
|
||||
|
||||
|
||||
83
Assets/_Game/Scripts/Editor/ReverseAnimation.cs
Normal file
83
Assets/_Game/Scripts/Editor/ReverseAnimation.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
using UnityEngine;
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// 선택한 AnimationClip의 키프레임 순서를 반전합니다.
|
||||
/// FBX 임포트 클립에는 적용 불가 — 우선 Extract 후 사용하세요.
|
||||
/// </summary>
|
||||
public static class ReverseAnimation
|
||||
{
|
||||
public static AnimationClip GetSelectedClip()
|
||||
{
|
||||
var clips = Selection.GetFiltered(typeof(AnimationClip), SelectionMode.Assets);
|
||||
if (clips.Length > 0)
|
||||
return clips[0] as AnimationClip;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
[MenuItem("Tools/ReverseAnimation")]
|
||||
public static void Reverse()
|
||||
{
|
||||
var clip = GetSelectedClip();
|
||||
if (clip == null)
|
||||
return;
|
||||
|
||||
float clipLength = clip.length;
|
||||
|
||||
List<AnimationCurve> curves = new List<AnimationCurve>();
|
||||
EditorCurveBinding[] editorCurveBindings = AnimationUtility.GetCurveBindings(clip);
|
||||
|
||||
foreach (EditorCurveBinding i in editorCurveBindings)
|
||||
{
|
||||
var curve = AnimationUtility.GetEditorCurve(clip, i);
|
||||
curves.Add(curve);
|
||||
}
|
||||
|
||||
clip.ClearCurves();
|
||||
|
||||
for (int i = 0; i < curves.Count; i++)
|
||||
{
|
||||
var curve = curves[i];
|
||||
var binding = editorCurveBindings[i];
|
||||
var keys = curve.keys;
|
||||
int keyCount = keys.Length;
|
||||
|
||||
var postWrapmode = curve.postWrapMode;
|
||||
curve.postWrapMode = curve.preWrapMode;
|
||||
curve.preWrapMode = postWrapmode;
|
||||
|
||||
for (int j = 0; j < keyCount; j++)
|
||||
{
|
||||
Keyframe K = keys[j];
|
||||
K.time = clipLength - K.time;
|
||||
|
||||
var tmp = -K.inTangent;
|
||||
K.inTangent = -K.outTangent;
|
||||
K.outTangent = tmp;
|
||||
|
||||
keys[j] = K;
|
||||
}
|
||||
|
||||
curve.keys = keys;
|
||||
clip.SetCurve(binding.path, binding.type, binding.propertyName, curve);
|
||||
}
|
||||
|
||||
// AnimationEvent 시간도 반전
|
||||
var events = AnimationUtility.GetAnimationEvents(clip);
|
||||
if (events.Length > 0)
|
||||
{
|
||||
for (int i = 0; i < events.Length; i++)
|
||||
{
|
||||
events[i].time = clipLength - events[i].time;
|
||||
}
|
||||
AnimationUtility.SetAnimationEvents(clip, events);
|
||||
}
|
||||
|
||||
Debug.Log("[ReverseAnimation] Animation reversed: " + clip.name);
|
||||
EditorUtility.SetDirty(clip);
|
||||
}
|
||||
}
|
||||
2
Assets/_Game/Scripts/Editor/ReverseAnimation.cs.meta
Normal file
2
Assets/_Game/Scripts/Editor/ReverseAnimation.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cf6abf78150fb14409bc53815b9f432f
|
||||
@@ -80,7 +80,7 @@ namespace Colosseum.Enemy
|
||||
[Tooltip("대형 패턴(시그니처/기동/조합) 직후 기본 패턴 최소 순환 횟수")]
|
||||
[Min(0)] [SerializeField] protected int basicLoopMinCountAfterBigPattern = 2;
|
||||
|
||||
[Header("Signature Pattern")]
|
||||
[Header("시그니처 효과 설정")]
|
||||
[Tooltip("시그니처 패턴 차단에 필요한 누적 피해 비율")]
|
||||
[Range(0f, 1f)] [SerializeField] protected float signatureRequiredDamageRatio = 0.1f;
|
||||
|
||||
@@ -124,12 +124,6 @@ namespace Colosseum.Enemy
|
||||
protected GameObject currentTarget;
|
||||
protected float nextTargetRefreshTime;
|
||||
protected int meleePatternCounter;
|
||||
protected bool isSignaturePatternActive;
|
||||
protected bool isPreviewingSignatureTelegraph;
|
||||
protected float signatureAccumulatedDamage;
|
||||
protected float signatureRequiredDamage;
|
||||
protected float signatureElapsedTime;
|
||||
protected float signatureTotalDuration;
|
||||
protected int basicLoopCountSinceLastBigPattern;
|
||||
|
||||
/// <summary>
|
||||
@@ -177,28 +171,55 @@ namespace Colosseum.Enemy
|
||||
return highestThreatTarget != null ? highestThreatTarget : FindNearestLivingTarget();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 패턴 진행 여부
|
||||
/// </summary>
|
||||
public bool IsSignaturePatternActive => isSignaturePatternActive;
|
||||
public string SignaturePatternName => isSignaturePatternActive && signaturePattern != null ? signaturePattern.PatternName : string.Empty;
|
||||
public float SignatureAccumulatedDamage => signatureAccumulatedDamage;
|
||||
public float SignatureRequiredDamage => signatureRequiredDamage;
|
||||
public float SignatureBreakProgressNormalized => signatureRequiredDamage > 0f ? Mathf.Clamp01(signatureAccumulatedDamage / signatureRequiredDamage) : 0f;
|
||||
public float SignatureElapsedTime => signatureElapsedTime;
|
||||
public float SignatureTotalDuration => signatureTotalDuration;
|
||||
public float SignatureCastProgressNormalized => signatureTotalDuration > 0f ? Mathf.Clamp01(signatureElapsedTime / signatureTotalDuration) : 0f;
|
||||
public float SignatureRemainingTime => Mathf.Max(0f, signatureTotalDuration - signatureElapsedTime);
|
||||
|
||||
/// <summary>
|
||||
/// 디버그 로그 출력 여부
|
||||
/// </summary>
|
||||
public bool DebugModeEnabled => debugMode;
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 실패 시 모든 플레이어에게 주는 기본 피해
|
||||
/// </summary>
|
||||
public float SignatureFailureDamage => signatureFailureDamage;
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 실패 시 모든 플레이어에게 적용할 디버프
|
||||
/// </summary>
|
||||
public AbnormalityData SignatureFailureAbnormality => signatureFailureAbnormality;
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 실패 시 넉백이 적용되는 반경
|
||||
/// </summary>
|
||||
public float SignatureFailureKnockbackRadius => signatureFailureKnockbackRadius;
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 실패 시 다운이 적용되는 반경
|
||||
/// </summary>
|
||||
public float SignatureFailureDownRadius => signatureFailureDownRadius;
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 실패 시 넉백 속도
|
||||
/// </summary>
|
||||
public float SignatureFailureKnockbackSpeed => signatureFailureKnockbackSpeed;
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 실패 시 넉백 지속 시간
|
||||
/// </summary>
|
||||
public float SignatureFailureKnockbackDuration => signatureFailureKnockbackDuration;
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 실패 시 다운 지속 시간
|
||||
/// </summary>
|
||||
public float SignatureFailureDownDuration => signatureFailureDownDuration;
|
||||
|
||||
/// <summary>
|
||||
/// 마지막 충전 차단 시 설정된 경직 시간 (BossPatternActionBase가 설정)
|
||||
/// </summary>
|
||||
public float LastChargeStaggerDuration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 기절 등으로 인해 보스 전투 로직을 진행할 수 없는 상태인지 여부
|
||||
/// </summary>
|
||||
public bool IsBehaviorSuppressed => isPreviewingSignatureTelegraph || (abnormalityManager != null && abnormalityManager.IsStunned);
|
||||
public bool IsBehaviorSuppressed => abnormalityManager != null && abnormalityManager.IsStunned;
|
||||
|
||||
/// <summary>
|
||||
/// 현재 보스 패턴 페이즈
|
||||
@@ -265,11 +286,7 @@ namespace Colosseum.Enemy
|
||||
if (TryStartPunishPattern())
|
||||
return;
|
||||
|
||||
// 2. 집행 개시 (Phase 3 시그니처)
|
||||
if (TryStartSignaturePatternInLoop())
|
||||
return;
|
||||
|
||||
// 3. 조합 패턴 (Phase 3, 드물게)
|
||||
// 2. 조합 패턴 (Phase 3, 드물게)
|
||||
if (TryStartComboPattern())
|
||||
return;
|
||||
|
||||
@@ -458,28 +475,6 @@ namespace Colosseum.Enemy
|
||||
Debug.Log($"[{source}] {message}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 패턴 사용 가능 여부를 반환합니다.
|
||||
/// </summary>
|
||||
public bool IsSignaturePatternReady()
|
||||
{
|
||||
if (!IsServer || bossEnemy == null || skillController == null)
|
||||
return false;
|
||||
|
||||
if (IsBehaviorSuppressed)
|
||||
return false;
|
||||
|
||||
if (activePatternCoroutine != null || isSignaturePatternActive)
|
||||
return false;
|
||||
|
||||
if (bossEnemy.IsDead || bossEnemy.IsTransitioning || skillController.IsPlayingAnimation)
|
||||
return false;
|
||||
|
||||
if (!IsPatternGracePeriodAllowed(signaturePattern))
|
||||
return false;
|
||||
|
||||
return IsPatternReady(signaturePattern);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 지정 패턴이 grace period를 통과했는지 반환합니다.
|
||||
@@ -510,7 +505,7 @@ namespace Colosseum.Enemy
|
||||
if (IsBehaviorSuppressed)
|
||||
return false;
|
||||
|
||||
if (activePatternCoroutine != null || isSignaturePatternActive)
|
||||
if (activePatternCoroutine != null)
|
||||
return false;
|
||||
|
||||
if (bossEnemy.IsDead || bossEnemy.IsTransitioning || skillController.IsPlayingAnimation)
|
||||
@@ -522,49 +517,6 @@ namespace Colosseum.Enemy
|
||||
return IsPatternReady(comboPattern);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 패턴을 시작합니다.
|
||||
/// </summary>
|
||||
public bool TryStartSignaturePattern(GameObject target)
|
||||
{
|
||||
if (!IsSignaturePatternReady())
|
||||
return false;
|
||||
|
||||
GameObject resolvedTarget = IsValidHostileTarget(target) ? target : FindNearestLivingTarget();
|
||||
currentTarget = resolvedTarget;
|
||||
activePatternCoroutine = StartCoroutine(RunSignaturePatternCoroutine(signaturePattern, resolvedTarget));
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 디버그 또는 특수 연출에서 시그니처 패턴을 강제로 시작합니다.
|
||||
/// </summary>
|
||||
public bool ForceStartSignaturePattern(GameObject target = null)
|
||||
{
|
||||
if (!IsServer || signaturePattern == null || activePatternCoroutine != null || isSignaturePatternActive)
|
||||
return false;
|
||||
|
||||
GameObject resolvedTarget = IsValidHostileTarget(target) ? target : ResolvePrimaryTarget();
|
||||
activePatternCoroutine = StartCoroutine(RunSignaturePatternCoroutine(signaturePattern, resolvedTarget));
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 네트워크 상태와 무관하게 시그니처 전조 모션만 미리보기로 재생합니다.
|
||||
/// 전조 연출 확인용 디버그 경로입니다.
|
||||
/// </summary>
|
||||
public bool PreviewSignatureTelegraph()
|
||||
{
|
||||
if (signaturePattern == null || skillController == null)
|
||||
return false;
|
||||
|
||||
if (activePatternCoroutine != null || isSignaturePatternActive || isPreviewingSignatureTelegraph)
|
||||
return false;
|
||||
|
||||
StartCoroutine(PreviewSignatureTelegraphCoroutine());
|
||||
return true;
|
||||
}
|
||||
|
||||
protected virtual bool TryStartPrimaryLoopPattern()
|
||||
{
|
||||
if (currentTarget == null)
|
||||
@@ -659,22 +611,6 @@ namespace Colosseum.Enemy
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 패턴을 context 루프에서 발동합니다.
|
||||
/// grace period와 Phase 제한을 적용합니다.
|
||||
/// </summary>
|
||||
protected virtual bool TryStartSignaturePatternInLoop()
|
||||
{
|
||||
if (!IsSignaturePatternReady())
|
||||
return false;
|
||||
|
||||
if (!IsPatternGracePeriodAllowed(signaturePattern))
|
||||
return false;
|
||||
|
||||
GameObject target = ResolvePrimaryTarget();
|
||||
return TryStartSignaturePattern(target);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Phase 3 조합 패턴을 발동합니다.
|
||||
/// </summary>
|
||||
@@ -864,298 +800,13 @@ namespace Colosseum.Enemy
|
||||
|
||||
if (behaviorGraphAgent == null)
|
||||
behaviorGraphAgent = GetComponent<BehaviorGraphAgent>();
|
||||
|
||||
if (enemyBase != null)
|
||||
{
|
||||
enemyBase.OnDamageTaken -= HandleBossDamageTaken;
|
||||
enemyBase.OnDamageTaken += HandleBossDamageTaken;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnNetworkDespawn()
|
||||
{
|
||||
if (enemyBase != null)
|
||||
{
|
||||
enemyBase.OnDamageTaken -= HandleBossDamageTaken;
|
||||
}
|
||||
|
||||
base.OnNetworkDespawn();
|
||||
}
|
||||
|
||||
private IEnumerator RunSignaturePatternCoroutine(BossPatternData pattern, GameObject target)
|
||||
{
|
||||
StopMovement();
|
||||
|
||||
isSignaturePatternActive = true;
|
||||
signatureAccumulatedDamage = 0f;
|
||||
signatureRequiredDamage = bossEnemy.MaxHealth * signatureRequiredDamageRatio;
|
||||
signatureElapsedTime = 0f;
|
||||
signatureTotalDuration = CalculatePatternDuration(pattern);
|
||||
|
||||
bool interrupted = false;
|
||||
bool completed = true;
|
||||
|
||||
for (int i = 0; i < pattern.Steps.Count; i++)
|
||||
{
|
||||
if (HasMetSignatureBreakThreshold())
|
||||
{
|
||||
interrupted = true;
|
||||
break;
|
||||
}
|
||||
|
||||
PatternStep step = pattern.Steps[i];
|
||||
if (step.Type == PatternStepType.Wait)
|
||||
{
|
||||
float remaining = step.Duration;
|
||||
while (remaining > 0f)
|
||||
{
|
||||
if (HasMetSignatureBreakThreshold())
|
||||
{
|
||||
interrupted = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (bossEnemy == null || bossEnemy.IsDead)
|
||||
{
|
||||
completed = false;
|
||||
break;
|
||||
}
|
||||
|
||||
signatureElapsedTime += Time.deltaTime;
|
||||
remaining -= Time.deltaTime;
|
||||
yield return null;
|
||||
}
|
||||
|
||||
if (interrupted || !completed)
|
||||
break;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (step.Skill == null)
|
||||
{
|
||||
completed = false;
|
||||
Debug.LogWarning($"[{GetType().Name}] 시그니처 패턴 스텝 스킬이 비어 있습니다. Pattern={pattern.PatternName}, Index={i}");
|
||||
break;
|
||||
}
|
||||
|
||||
if (!skillController.ExecuteSkill(step.Skill))
|
||||
{
|
||||
completed = false;
|
||||
LogDebug(GetType().Name, $"시그니처 스킬 실행 실패: {step.Skill.SkillName}");
|
||||
break;
|
||||
}
|
||||
|
||||
while (skillController != null && skillController.IsPlayingAnimation)
|
||||
{
|
||||
if (HasMetSignatureBreakThreshold())
|
||||
{
|
||||
interrupted = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (bossEnemy == null || bossEnemy.IsDead)
|
||||
{
|
||||
completed = false;
|
||||
break;
|
||||
}
|
||||
|
||||
signatureElapsedTime += Time.deltaTime;
|
||||
yield return null;
|
||||
}
|
||||
|
||||
if (interrupted || !completed)
|
||||
break;
|
||||
}
|
||||
|
||||
if (interrupted)
|
||||
{
|
||||
skillController?.CancelSkill(SkillCancelReason.Interrupt);
|
||||
UsePatternAction.MarkPatternUsed(gameObject, pattern);
|
||||
LogDebug(GetType().Name, $"시그니처 차단 성공: 누적 피해 {signatureAccumulatedDamage:F1} / 필요 {signatureRequiredDamage:F1}");
|
||||
CombatBalanceTracker.RecordBossEvent("집행 개시 차단 성공");
|
||||
|
||||
if (signatureSuccessStaggerDuration > 0f)
|
||||
{
|
||||
if (enemyBase != null && enemyBase.Animator != null &&
|
||||
HasAnimatorParameter(enemyBase.Animator, "Hit", AnimatorControllerParameterType.Trigger))
|
||||
{
|
||||
enemyBase.Animator.SetTrigger("Hit");
|
||||
}
|
||||
|
||||
float endTime = Time.time + signatureSuccessStaggerDuration;
|
||||
while (Time.time < endTime && bossEnemy != null && !bossEnemy.IsDead)
|
||||
{
|
||||
StopMovement();
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (completed)
|
||||
{
|
||||
UsePatternAction.MarkPatternUsed(gameObject, pattern);
|
||||
LogDebug(GetType().Name, $"시그니처 실패: 누적 피해 {signatureAccumulatedDamage:F1} / 필요 {signatureRequiredDamage:F1}");
|
||||
CombatBalanceTracker.RecordBossEvent("집행 개시 실패");
|
||||
ExecuteSignatureFailure();
|
||||
}
|
||||
|
||||
if (abnormalityManager != null && signatureTelegraphAbnormality != null)
|
||||
{
|
||||
abnormalityManager.RemoveAbnormality(signatureTelegraphAbnormality);
|
||||
}
|
||||
|
||||
isSignaturePatternActive = false;
|
||||
signatureAccumulatedDamage = 0f;
|
||||
signatureRequiredDamage = 0f;
|
||||
signatureElapsedTime = 0f;
|
||||
signatureTotalDuration = 0f;
|
||||
activePatternCoroutine = null;
|
||||
}
|
||||
|
||||
private IEnumerator PreviewSignatureTelegraphCoroutine()
|
||||
{
|
||||
bool restoreBehaviorGraph = behaviorGraphAgent != null && behaviorGraphAgent.enabled;
|
||||
isPreviewingSignatureTelegraph = true;
|
||||
|
||||
if (restoreBehaviorGraph)
|
||||
{
|
||||
behaviorGraphAgent.enabled = false;
|
||||
}
|
||||
|
||||
StopMovement();
|
||||
|
||||
if (skillController != null && skillController.IsPlayingAnimation)
|
||||
{
|
||||
skillController.CancelSkill(SkillCancelReason.Interrupt);
|
||||
yield return null;
|
||||
}
|
||||
|
||||
bool executed = false;
|
||||
for (int i = 0; i < signaturePattern.Steps.Count; i++)
|
||||
{
|
||||
PatternStep step = signaturePattern.Steps[i];
|
||||
if (step == null || step.Type != PatternStepType.Skill || step.Skill == null)
|
||||
continue;
|
||||
|
||||
executed = skillController.ExecuteSkill(step.Skill);
|
||||
break;
|
||||
}
|
||||
|
||||
if (executed)
|
||||
{
|
||||
while (skillController != null && skillController.IsPlayingAnimation)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (abnormalityManager != null && signatureTelegraphAbnormality != null)
|
||||
{
|
||||
abnormalityManager.RemoveAbnormality(signatureTelegraphAbnormality);
|
||||
}
|
||||
|
||||
if (restoreBehaviorGraph && behaviorGraphAgent != null)
|
||||
{
|
||||
behaviorGraphAgent.enabled = true;
|
||||
}
|
||||
|
||||
isPreviewingSignatureTelegraph = false;
|
||||
}
|
||||
|
||||
private static float CalculatePatternDuration(BossPatternData pattern)
|
||||
{
|
||||
if (pattern == null || pattern.Steps == null)
|
||||
return 0f;
|
||||
|
||||
float totalDuration = 0f;
|
||||
for (int i = 0; i < pattern.Steps.Count; i++)
|
||||
{
|
||||
PatternStep step = pattern.Steps[i];
|
||||
if (step == null)
|
||||
continue;
|
||||
|
||||
if (step.Type == PatternStepType.Wait)
|
||||
{
|
||||
totalDuration += Mathf.Max(0f, step.Duration);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (step.Skill == null)
|
||||
continue;
|
||||
|
||||
AnimationClip skillClip = step.Skill.SkillClip;
|
||||
if (skillClip != null)
|
||||
{
|
||||
float animationSpeed = Mathf.Max(0.01f, step.Skill.AnimationSpeed);
|
||||
totalDuration += skillClip.length / animationSpeed;
|
||||
}
|
||||
|
||||
if (step.Skill.EndClip != null)
|
||||
{
|
||||
totalDuration += step.Skill.EndClip.length;
|
||||
}
|
||||
}
|
||||
|
||||
return totalDuration;
|
||||
}
|
||||
|
||||
private void ExecuteSignatureFailure()
|
||||
{
|
||||
PlayerNetworkController[] players = FindObjectsByType<PlayerNetworkController>(FindObjectsSortMode.None);
|
||||
for (int i = 0; i < players.Length; i++)
|
||||
{
|
||||
PlayerNetworkController player = players[i];
|
||||
if (player == null || player.IsDead || !player.gameObject.activeInHierarchy)
|
||||
continue;
|
||||
|
||||
GameObject target = player.gameObject;
|
||||
if (!IsValidHostileTarget(target))
|
||||
continue;
|
||||
|
||||
player.TakeDamage(signatureFailureDamage, gameObject);
|
||||
|
||||
AbnormalityManager abnormalityManager = target.GetComponent<AbnormalityManager>();
|
||||
if (abnormalityManager != null && signatureFailureAbnormality != null)
|
||||
{
|
||||
abnormalityManager.ApplyAbnormality(signatureFailureAbnormality, gameObject);
|
||||
}
|
||||
|
||||
HitReactionController hitReactionController = target.GetComponent<HitReactionController>();
|
||||
if (hitReactionController == null)
|
||||
continue;
|
||||
|
||||
float distance = Vector3.Distance(transform.position, target.transform.position);
|
||||
if (distance <= signatureFailureDownRadius)
|
||||
{
|
||||
hitReactionController.ApplyDown(signatureFailureDownDuration);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (distance > signatureFailureKnockbackRadius)
|
||||
continue;
|
||||
|
||||
Vector3 knockbackDirection = target.transform.position - transform.position;
|
||||
knockbackDirection.y = 0f;
|
||||
if (knockbackDirection.sqrMagnitude < 0.0001f)
|
||||
{
|
||||
knockbackDirection = transform.forward;
|
||||
}
|
||||
|
||||
hitReactionController.ApplyKnockback(knockbackDirection.normalized * signatureFailureKnockbackSpeed, signatureFailureKnockbackDuration);
|
||||
}
|
||||
}
|
||||
|
||||
private bool HasMetSignatureBreakThreshold()
|
||||
{
|
||||
if (!isSignaturePatternActive)
|
||||
return false;
|
||||
|
||||
if (signatureRequiredDamage <= 0f)
|
||||
return true;
|
||||
|
||||
return signatureAccumulatedDamage >= signatureRequiredDamage;
|
||||
}
|
||||
|
||||
private static bool HasAnimatorParameter(Animator animator, string parameterName, AnimatorControllerParameterType parameterType)
|
||||
{
|
||||
if (animator == null || string.IsNullOrEmpty(parameterName))
|
||||
@@ -1171,13 +822,5 @@ namespace Colosseum.Enemy
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void HandleBossDamageTaken(float damage)
|
||||
{
|
||||
if (!IsServer || !isSignaturePatternActive || damage <= 0f)
|
||||
return;
|
||||
|
||||
signatureAccumulatedDamage += damage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,50 +377,12 @@ namespace Colosseum.UI
|
||||
|
||||
private void UpdateSignatureUi()
|
||||
{
|
||||
if (!showSignatureUi)
|
||||
{
|
||||
SetSignatureVisible(false);
|
||||
return;
|
||||
}
|
||||
|
||||
// 시그니처 패턴은 이제 BT의 ChargeWait 스텝으로 처리됩니다.
|
||||
// 시그니처 전용 UI 업데이트는 비활성화합니다.
|
||||
if (signatureRoot == null)
|
||||
return;
|
||||
|
||||
if (targetBoss == null)
|
||||
{
|
||||
SetSignatureVisible(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (bossCombatContext == null)
|
||||
bossCombatContext = targetBoss.GetComponent<BossCombatBehaviorContext>();
|
||||
|
||||
if (bossCombatContext == null || !bossCombatContext.IsSignaturePatternActive)
|
||||
{
|
||||
SetSignatureVisible(false);
|
||||
return;
|
||||
}
|
||||
|
||||
SetSignatureVisible(true);
|
||||
|
||||
if (signatureNameText != null)
|
||||
{
|
||||
signatureNameText.text = string.IsNullOrEmpty(bossCombatContext.SignaturePatternName)
|
||||
? "시그니처"
|
||||
: bossCombatContext.SignaturePatternName;
|
||||
}
|
||||
|
||||
if (signatureDetailText != null)
|
||||
{
|
||||
signatureDetailText.text =
|
||||
$"차단 {Mathf.CeilToInt(bossCombatContext.SignatureAccumulatedDamage)} / {Mathf.CeilToInt(bossCombatContext.SignatureRequiredDamage)}" +
|
||||
$" | {bossCombatContext.SignatureRemainingTime:0.0}s";
|
||||
}
|
||||
|
||||
if (signatureFillImage != null)
|
||||
{
|
||||
signatureFillImage.fillAmount = 1f - bossCombatContext.SignatureCastProgressNormalized;
|
||||
}
|
||||
}
|
||||
|
||||
private void EnsureSignatureUi()
|
||||
|
||||
Reference in New Issue
Block a user