feat: 드로그 투척 패턴 및 보스명 UI 정리
- 공통 보스 BT 프레임워크에 utility 패턴 역할과 준비/실행 브랜치를 추가 - 드로그 투척 패턴, 스킬, 투사체 이펙트를 연결하고 1인 플레이에서도 주 대상 fallback으로 발동되게 조정 - 투척 스폰 회전 계산을 보강해 zero vector 경고를 제거 - EnemyData와 VictoryUI 보스명을 투기장의 집행자 드로그 기준으로 정리 - Unity 플레이 검증으로 1인 호스트에서 투척 실행과 후속 전투 루프를 확인
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
|
||||
using Colosseum.Enemy;
|
||||
|
||||
using Unity.Behavior;
|
||||
using Unity.Properties;
|
||||
|
||||
using Action = Unity.Behavior.Action;
|
||||
|
||||
/// <summary>
|
||||
/// 공통 원거리 견제 패턴의 준비 여부를 확인합니다.
|
||||
/// </summary>
|
||||
[Serializable, GeneratePropertyBag]
|
||||
[NodeDescription(name: "Check Utility Pattern Ready", story: "원거리 견제 패턴 준비 완료", category: "Action", id: "e3a3f4bd4f214efc873109631e5195db")]
|
||||
public partial class CheckUtilityPatternReadyAction : CheckPatternReadyActionBase
|
||||
{
|
||||
protected override BossCombatPatternRole PatternRole => BossCombatPatternRole.Utility;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 15de0eb23ee195a42a07c23c18f9fa9a
|
||||
@@ -0,0 +1,98 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Colosseum;
|
||||
using Colosseum.Combat;
|
||||
using Colosseum.Enemy;
|
||||
using Colosseum.Player;
|
||||
|
||||
using Unity.Behavior;
|
||||
using Unity.Properties;
|
||||
using UnityEngine;
|
||||
|
||||
using Action = Unity.Behavior.Action;
|
||||
|
||||
/// <summary>
|
||||
/// 현재 주 대상이 아닌 다른 원거리 대상을 선택합니다.
|
||||
/// </summary>
|
||||
[Serializable, GeneratePropertyBag]
|
||||
[NodeDescription(
|
||||
name: "Select Alternate Target By Distance",
|
||||
story: "주 대상이 아닌 원거리 대상 선택",
|
||||
category: "Action",
|
||||
id: "1fe74f607036406c8857c1a23f42c8a2")]
|
||||
public partial class SelectAlternateTargetByDistanceAction : Action
|
||||
{
|
||||
[SerializeReference]
|
||||
public BlackboardVariable<GameObject> Target;
|
||||
|
||||
[SerializeReference]
|
||||
public BlackboardVariable<float> MinRange = new BlackboardVariable<float>(0f);
|
||||
|
||||
[SerializeReference]
|
||||
public BlackboardVariable<float> MaxRange = new BlackboardVariable<float>(0f);
|
||||
|
||||
protected override Status OnStart()
|
||||
{
|
||||
BossCombatBehaviorContext context = GameObject.GetComponent<BossCombatBehaviorContext>();
|
||||
if (context == null)
|
||||
return Status.Failure;
|
||||
|
||||
float minRange = MinRange.Value > 0f ? MinRange.Value : context.UtilityTriggerDistance;
|
||||
float maxRange = MaxRange.Value > 0f
|
||||
? MaxRange.Value
|
||||
: (context.EnemyBase != null && context.EnemyBase.Data != null ? context.EnemyBase.Data.AggroRange : 20f);
|
||||
|
||||
GameObject selectedTarget = SelectTarget(context, minRange, maxRange);
|
||||
if (selectedTarget == null)
|
||||
return Status.Failure;
|
||||
|
||||
Target.Value = selectedTarget;
|
||||
return Status.Success;
|
||||
}
|
||||
|
||||
private GameObject SelectTarget(BossCombatBehaviorContext context, float minRange, float maxRange)
|
||||
{
|
||||
PlayerNetworkController[] players = UnityEngine.Object.FindObjectsByType<PlayerNetworkController>(FindObjectsSortMode.None);
|
||||
if (players == null || players.Length == 0)
|
||||
return null;
|
||||
|
||||
GameObject primaryTarget = context.ResolvePrimaryTarget();
|
||||
List<GameObject> validTargets = new List<GameObject>();
|
||||
|
||||
for (int i = 0; i < players.Length; i++)
|
||||
{
|
||||
PlayerNetworkController player = players[i];
|
||||
if (player == null || player.IsDead || !player.gameObject.activeInHierarchy)
|
||||
continue;
|
||||
|
||||
GameObject candidate = player.gameObject;
|
||||
if (candidate == primaryTarget)
|
||||
continue;
|
||||
|
||||
if (!context.IsValidHostileTarget(candidate))
|
||||
continue;
|
||||
|
||||
float distance = Vector3.Distance(GameObject.transform.position, candidate.transform.position);
|
||||
if (distance < minRange || distance > maxRange)
|
||||
continue;
|
||||
|
||||
validTargets.Add(candidate);
|
||||
}
|
||||
|
||||
if (validTargets.Count == 0)
|
||||
{
|
||||
if (primaryTarget != null && context.IsValidHostileTarget(primaryTarget))
|
||||
{
|
||||
float primaryDistance = Vector3.Distance(GameObject.transform.position, primaryTarget.transform.position);
|
||||
if (primaryDistance >= minRange && primaryDistance <= maxRange)
|
||||
return primaryTarget;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
int randomIndex = UnityEngine.Random.Range(0, validTargets.Count);
|
||||
return validTargets[randomIndex];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5bc0da0fc1e1b81428d64c0c8b31a402
|
||||
@@ -33,6 +33,9 @@ public abstract partial class UsePatternRoleActionBase : BossPatternActionBase
|
||||
if (target == null && PatternRole == BossCombatPatternRole.Mobility)
|
||||
target = context != null ? context.FindMobilityTarget() : null;
|
||||
|
||||
if (target == null && PatternRole == BossCombatPatternRole.Utility)
|
||||
target = context != null ? context.FindUtilityTarget() : null;
|
||||
|
||||
if (target == null)
|
||||
return false;
|
||||
|
||||
@@ -52,6 +55,13 @@ public abstract partial class UsePatternRoleActionBase : BossPatternActionBase
|
||||
: context.FindMobilityTarget();
|
||||
}
|
||||
|
||||
if (PatternRole == BossCombatPatternRole.Utility && context != null)
|
||||
{
|
||||
return context.IsValidUtilityTarget(fallbackTarget)
|
||||
? fallbackTarget
|
||||
: context.FindUtilityTarget();
|
||||
}
|
||||
|
||||
return base.ResolveStepTarget(fallbackTarget);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
|
||||
using Colosseum.Enemy;
|
||||
|
||||
using Unity.Behavior;
|
||||
using Unity.Properties;
|
||||
|
||||
/// <summary>
|
||||
/// 공통 원거리 견제 패턴을 실행합니다.
|
||||
/// </summary>
|
||||
[Serializable, GeneratePropertyBag]
|
||||
[NodeDescription(name: "Use Utility Pattern", story: "원거리 견제 패턴 실행", category: "Action", id: "f29d4556f2d04f6bb80418f9f9fe2c68")]
|
||||
public partial class UseUtilityPatternAction : UsePatternRoleActionBase
|
||||
{
|
||||
protected override BossCombatPatternRole PatternRole => BossCombatPatternRole.Utility;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 36c98678f964a7447bede88fedc04561
|
||||
@@ -68,12 +68,13 @@ namespace Colosseum.Editor
|
||||
object selectorNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, runtimeAssembly.GetType("Unity.Behavior.SelectorComposite", true), new Vector2(420f, -280f));
|
||||
|
||||
object signatureSequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true), new Vector2(-1020f, -40f));
|
||||
object downSequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true), new Vector2(-620f, -40f));
|
||||
object leapSequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true), new Vector2(-220f, -40f));
|
||||
object slamSequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true), new Vector2(180f, -40f));
|
||||
object mainSequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true), new Vector2(580f, -40f));
|
||||
object slamFallbackSequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true), new Vector2(980f, -40f));
|
||||
object chaseSequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true), new Vector2(1380f, -40f));
|
||||
object downSequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true), new Vector2(-780f, -40f));
|
||||
object utilitySequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true), new Vector2(-380f, -40f));
|
||||
object leapSequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true), new Vector2(20f, -40f));
|
||||
object slamSequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true), new Vector2(420f, -40f));
|
||||
object mainSequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true), new Vector2(820f, -40f));
|
||||
object slamFallbackSequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true), new Vector2(1220f, -40f));
|
||||
object chaseSequence = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, runtimeAssembly.GetType("Unity.Behavior.SequenceComposite", true), new Vector2(1620f, -40f));
|
||||
|
||||
object signatureRefreshNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(RefreshPrimaryTargetAction), new Vector2(-1140f, 240f));
|
||||
object signatureHasTargetNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(ValidateTargetAction), new Vector2(-1020f, 240f));
|
||||
@@ -84,39 +85,44 @@ namespace Colosseum.Editor
|
||||
object downReadyNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(CheckPunishPatternReadyAction), new Vector2(-620f, 240f));
|
||||
object downUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UsePunishPatternAction), new Vector2(-500f, 240f));
|
||||
|
||||
object leapSelectNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(SelectTargetByDistanceAction), new Vector2(-340f, 240f));
|
||||
object leapReadyNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(CheckMobilityPatternReadyAction), new Vector2(-220f, 240f));
|
||||
object leapUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UseMobilityPatternAction), new Vector2(-100f, 240f));
|
||||
object utilitySelectNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(SelectAlternateTargetByDistanceAction), new Vector2(-500f, 240f));
|
||||
object utilityReadyNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(CheckUtilityPatternReadyAction), new Vector2(-380f, 240f));
|
||||
object utilityUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UseUtilityPatternAction), new Vector2(-260f, 240f));
|
||||
|
||||
object slamRefreshNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(RefreshPrimaryTargetAction), new Vector2(0f, 240f));
|
||||
object slamHasTargetNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(ValidateTargetAction), new Vector2(120f, 240f));
|
||||
object slamRangeNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(CheckTargetInAttackRangeAction), new Vector2(240f, 240f));
|
||||
object slamTurnNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(CheckSecondaryPatternTurnAction), new Vector2(360f, 240f));
|
||||
object slamReadyNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(CheckSecondaryPatternReadyAction), new Vector2(480f, 240f));
|
||||
object slamUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UseSecondaryPatternAction), new Vector2(600f, 240f));
|
||||
object leapSelectNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(SelectTargetByDistanceAction), new Vector2(-100f, 240f));
|
||||
object leapReadyNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(CheckMobilityPatternReadyAction), new Vector2(20f, 240f));
|
||||
object leapUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UseMobilityPatternAction), new Vector2(140f, 240f));
|
||||
|
||||
object mainRefreshNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(RefreshPrimaryTargetAction), new Vector2(520f, 240f));
|
||||
object mainHasTargetNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(ValidateTargetAction), new Vector2(640f, 240f));
|
||||
object mainRangeNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(CheckTargetInAttackRangeAction), new Vector2(760f, 240f));
|
||||
object mainReadyNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(CheckPrimaryPatternReadyAction), new Vector2(880f, 240f));
|
||||
object mainUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UsePrimaryPatternAction), new Vector2(1000f, 240f));
|
||||
object slamRefreshNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(RefreshPrimaryTargetAction), new Vector2(240f, 240f));
|
||||
object slamHasTargetNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(ValidateTargetAction), new Vector2(360f, 240f));
|
||||
object slamRangeNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(CheckTargetInAttackRangeAction), new Vector2(480f, 240f));
|
||||
object slamTurnNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(CheckSecondaryPatternTurnAction), new Vector2(600f, 240f));
|
||||
object slamReadyNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(CheckSecondaryPatternReadyAction), new Vector2(720f, 240f));
|
||||
object slamUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UseSecondaryPatternAction), new Vector2(840f, 240f));
|
||||
|
||||
object fallbackRefreshNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(RefreshPrimaryTargetAction), new Vector2(920f, 240f));
|
||||
object fallbackHasTargetNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(ValidateTargetAction), new Vector2(1040f, 240f));
|
||||
object fallbackRangeNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(CheckTargetInAttackRangeAction), new Vector2(1160f, 240f));
|
||||
object fallbackReadyNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(CheckSecondaryPatternReadyAction), new Vector2(1280f, 240f));
|
||||
object fallbackUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UseSecondaryPatternAction), new Vector2(1400f, 240f));
|
||||
object mainRefreshNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(RefreshPrimaryTargetAction), new Vector2(760f, 240f));
|
||||
object mainHasTargetNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(ValidateTargetAction), new Vector2(880f, 240f));
|
||||
object mainRangeNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(CheckTargetInAttackRangeAction), new Vector2(1000f, 240f));
|
||||
object mainReadyNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(CheckPrimaryPatternReadyAction), new Vector2(1120f, 240f));
|
||||
object mainUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UsePrimaryPatternAction), new Vector2(1240f, 240f));
|
||||
|
||||
object chaseRefreshNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(RefreshPrimaryTargetAction), new Vector2(1320f, 240f));
|
||||
object chaseHasTargetNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(ValidateTargetAction), new Vector2(1440f, 240f));
|
||||
object chaseUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(ChaseTargetAction), new Vector2(1560f, 240f));
|
||||
object fallbackRefreshNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(RefreshPrimaryTargetAction), new Vector2(1160f, 240f));
|
||||
object fallbackHasTargetNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(ValidateTargetAction), new Vector2(1280f, 240f));
|
||||
object fallbackRangeNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(CheckTargetInAttackRangeAction), new Vector2(1400f, 240f));
|
||||
object fallbackReadyNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(CheckSecondaryPatternReadyAction), new Vector2(1520f, 240f));
|
||||
object fallbackUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(UseSecondaryPatternAction), new Vector2(1640f, 240f));
|
||||
|
||||
object chaseRefreshNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(RefreshPrimaryTargetAction), new Vector2(1560f, 240f));
|
||||
object chaseHasTargetNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(ValidateTargetAction), new Vector2(1680f, 240f));
|
||||
object chaseUseNode = CreateNode(graphAsset, createNodeMethod, getNodeInfoMethod, typeof(ChaseTargetAction), new Vector2(1800f, 240f));
|
||||
|
||||
Connect(graphAsset, connectEdgeMethod, GetDefaultOutputPort(startNode), GetDefaultInputPort(repeatNode));
|
||||
Connect(graphAsset, connectEdgeMethod, GetDefaultOutputPort(repeatNode), GetDefaultInputPort(selectorNode));
|
||||
ConnectChildren(graphAsset, connectEdgeMethod, selectorNode, signatureSequence, downSequence, leapSequence, slamSequence, mainSequence, slamFallbackSequence, chaseSequence);
|
||||
ConnectChildren(graphAsset, connectEdgeMethod, selectorNode, signatureSequence, downSequence, utilitySequence, leapSequence, slamSequence, mainSequence, slamFallbackSequence, chaseSequence);
|
||||
|
||||
ConnectChildren(graphAsset, connectEdgeMethod, signatureSequence, signatureRefreshNode, signatureHasTargetNode, signatureReadyNode, signatureUseNode);
|
||||
ConnectChildren(graphAsset, connectEdgeMethod, downSequence, downSelectNode, downReadyNode, downUseNode);
|
||||
ConnectChildren(graphAsset, connectEdgeMethod, utilitySequence, utilitySelectNode, utilityReadyNode, utilityUseNode);
|
||||
ConnectChildren(graphAsset, connectEdgeMethod, leapSequence, leapSelectNode, leapReadyNode, leapUseNode);
|
||||
ConnectChildren(graphAsset, connectEdgeMethod, slamSequence, slamRefreshNode, slamHasTargetNode, slamRangeNode, slamTurnNode, slamReadyNode, slamUseNode);
|
||||
ConnectChildren(graphAsset, connectEdgeMethod, mainSequence, mainRefreshNode, mainHasTargetNode, mainRangeNode, mainReadyNode, mainUseNode);
|
||||
@@ -128,6 +134,8 @@ namespace Colosseum.Editor
|
||||
LinkTarget(signatureUseNode, targetVariable);
|
||||
LinkTarget(downSelectNode, targetVariable);
|
||||
LinkTarget(downUseNode, targetVariable);
|
||||
LinkTarget(utilitySelectNode, targetVariable);
|
||||
LinkTarget(utilityUseNode, targetVariable);
|
||||
LinkTarget(leapSelectNode, targetVariable);
|
||||
LinkTarget(leapUseNode, targetVariable);
|
||||
LinkTarget(slamRefreshNode, targetVariable);
|
||||
|
||||
@@ -43,6 +43,9 @@ namespace Colosseum.Enemy
|
||||
[FormerlySerializedAs("leapPattern")]
|
||||
[SerializeField] protected BossPatternData mobilityPattern;
|
||||
|
||||
[Tooltip("비주 대상 원거리 견제 패턴")]
|
||||
[SerializeField] protected BossPatternData utilityPattern;
|
||||
|
||||
[Tooltip("특정 상황에서 우선 발동하는 징벌 패턴")]
|
||||
[FormerlySerializedAs("downPunishPattern")]
|
||||
[SerializeField] protected BossPatternData punishPattern;
|
||||
@@ -70,6 +73,9 @@ namespace Colosseum.Enemy
|
||||
[FormerlySerializedAs("downPunishSearchRadius")]
|
||||
[Min(0f)] [SerializeField] protected float punishSearchRadius = 6f;
|
||||
|
||||
[Tooltip("원거리 견제 패턴을 고려하기 시작하는 최소 거리")]
|
||||
[Min(0f)] [SerializeField] protected float utilityTriggerDistance = 5f;
|
||||
|
||||
[Header("Pattern Cadence")]
|
||||
[Tooltip("1페이즈에서 몇 번의 근접 패턴마다 보조 패턴을 섞을지")]
|
||||
[FormerlySerializedAs("phase1SlamInterval")]
|
||||
@@ -141,11 +147,41 @@ namespace Colosseum.Enemy
|
||||
/// </summary>
|
||||
public float MobilityTriggerDistance => mobilityTriggerDistance;
|
||||
|
||||
/// <summary>
|
||||
/// 원거리 견제 패턴을 고려하는 최소 거리
|
||||
/// </summary>
|
||||
public float UtilityTriggerDistance => utilityTriggerDistance;
|
||||
|
||||
/// <summary>
|
||||
/// 징벌 패턴을 고려하는 최대 반경
|
||||
/// </summary>
|
||||
public float PunishSearchRadius => punishSearchRadius;
|
||||
|
||||
/// <summary>
|
||||
/// 현재 전투 대상
|
||||
/// </summary>
|
||||
public GameObject CurrentTarget => currentTarget;
|
||||
|
||||
/// <summary>
|
||||
/// EnemyBase 접근자
|
||||
/// </summary>
|
||||
public EnemyBase EnemyBase => enemyBase;
|
||||
|
||||
/// <summary>
|
||||
/// 현재 전투 기준이 되는 주 대상을 반환합니다.
|
||||
/// </summary>
|
||||
public GameObject ResolvePrimaryTarget()
|
||||
{
|
||||
if (IsValidHostileTarget(currentTarget))
|
||||
return currentTarget;
|
||||
|
||||
GameObject highestThreatTarget = enemyBase != null
|
||||
? enemyBase.GetHighestThreatTarget(currentTarget, null, enemyBase.Data != null ? enemyBase.Data.AggroRange : Mathf.Infinity)
|
||||
: null;
|
||||
|
||||
return highestThreatTarget != null ? highestThreatTarget : FindNearestLivingTarget();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 시그니처 패턴 진행 여부
|
||||
/// </summary>
|
||||
@@ -214,6 +250,9 @@ namespace Colosseum.Enemy
|
||||
if (TryStartMobilityPattern())
|
||||
return;
|
||||
|
||||
if (TryStartUtilityPattern())
|
||||
return;
|
||||
|
||||
TryStartPrimaryLoopPattern();
|
||||
}
|
||||
|
||||
@@ -227,6 +266,7 @@ namespace Colosseum.Enemy
|
||||
BossCombatPatternRole.Primary => primaryPattern,
|
||||
BossCombatPatternRole.Secondary => secondaryPattern,
|
||||
BossCombatPatternRole.Mobility => mobilityPattern,
|
||||
BossCombatPatternRole.Utility => utilityPattern,
|
||||
BossCombatPatternRole.Punish => punishPattern,
|
||||
BossCombatPatternRole.Signature => signaturePattern,
|
||||
_ => null,
|
||||
@@ -324,6 +364,61 @@ namespace Colosseum.Enemy
|
||||
return farthestTarget;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 원거리 견제 패턴 대상으로 유효한지 확인합니다.
|
||||
/// </summary>
|
||||
public bool IsValidUtilityTarget(GameObject candidate)
|
||||
{
|
||||
if (!IsValidHostileTarget(candidate))
|
||||
return false;
|
||||
|
||||
if (candidate == ResolvePrimaryTarget())
|
||||
return false;
|
||||
|
||||
float maxDistance = enemyBase != null && enemyBase.Data != null ? enemyBase.Data.AggroRange : 20f;
|
||||
float distance = Vector3.Distance(transform.position, candidate.transform.position);
|
||||
return distance >= utilityTriggerDistance && distance <= maxDistance;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 현재 주 대상이 아닌 원거리 견제 대상을 찾습니다.
|
||||
/// </summary>
|
||||
public GameObject FindUtilityTarget()
|
||||
{
|
||||
PlayerNetworkController[] players = FindObjectsByType<PlayerNetworkController>(FindObjectsSortMode.None);
|
||||
List<GameObject> validTargets = new List<GameObject>();
|
||||
GameObject primaryTarget = ResolvePrimaryTarget();
|
||||
|
||||
for (int i = 0; i < players.Length; i++)
|
||||
{
|
||||
PlayerNetworkController player = players[i];
|
||||
if (player == null || player.IsDead || !player.gameObject.activeInHierarchy)
|
||||
continue;
|
||||
|
||||
GameObject candidate = player.gameObject;
|
||||
if (!IsValidUtilityTarget(candidate))
|
||||
continue;
|
||||
|
||||
validTargets.Add(candidate);
|
||||
}
|
||||
|
||||
if (validTargets.Count == 0)
|
||||
{
|
||||
if (IsValidHostileTarget(primaryTarget))
|
||||
{
|
||||
float maxDistance = enemyBase != null && enemyBase.Data != null ? enemyBase.Data.AggroRange : 20f;
|
||||
float distance = Vector3.Distance(transform.position, primaryTarget.transform.position);
|
||||
if (distance >= utilityTriggerDistance && distance <= maxDistance)
|
||||
return primaryTarget;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
int randomIndex = UnityEngine.Random.Range(0, validTargets.Count);
|
||||
return validTargets[randomIndex];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 가장 가까운 생존 플레이어를 찾습니다.
|
||||
/// </summary>
|
||||
@@ -432,6 +527,21 @@ namespace Colosseum.Enemy
|
||||
return true;
|
||||
}
|
||||
|
||||
protected virtual bool TryStartUtilityPattern()
|
||||
{
|
||||
BossPatternData pattern = GetPattern(BossCombatPatternRole.Utility);
|
||||
if (!IsPatternReady(pattern))
|
||||
return false;
|
||||
|
||||
GameObject target = FindUtilityTarget();
|
||||
if (target == null)
|
||||
return false;
|
||||
|
||||
currentTarget = target;
|
||||
StartPattern(pattern, target);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected virtual BossPatternData SelectPrimaryLoopPattern()
|
||||
{
|
||||
BossPatternData primary = GetPattern(BossCombatPatternRole.Primary);
|
||||
@@ -466,6 +576,7 @@ namespace Colosseum.Enemy
|
||||
if (pattern == null || activePatternCoroutine != null)
|
||||
return;
|
||||
|
||||
currentTarget = target;
|
||||
LogDebug(GetType().Name, $"패턴 시작: {pattern.PatternName} / Target={(target != null ? target.name : "None")} / Phase={CurrentPatternPhase}");
|
||||
activePatternCoroutine = StartCoroutine(RunPatternCoroutine(pattern, target));
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace Colosseum.Enemy
|
||||
Mobility = 2,
|
||||
Punish = 3,
|
||||
Signature = 4,
|
||||
Utility = 5,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using UnityEngine;
|
||||
using Unity.Netcode;
|
||||
|
||||
using Colosseum.Enemy;
|
||||
|
||||
namespace Colosseum.Skills.Effects
|
||||
{
|
||||
/// <summary>
|
||||
@@ -15,6 +17,8 @@ namespace Colosseum.Skills.Effects
|
||||
[SerializeField] private Vector3 spawnOffset = Vector3.zero;
|
||||
[SerializeField] private bool parentToCaster = false;
|
||||
[Min(0f)] [SerializeField] private float autoDestroyTime = 3f;
|
||||
[Tooltip("전투 컨텍스트의 현재 타겟을 스폰 방향 계산에 사용할지 여부")]
|
||||
[SerializeField] private bool useCombatContextTarget = false;
|
||||
|
||||
[Header("Hit Settings")]
|
||||
[Tooltip("투사체가 대상에 명중했을 때 적용할 효과. 미설정 시 명중 효과 없음.")]
|
||||
@@ -24,8 +28,9 @@ namespace Colosseum.Skills.Effects
|
||||
{
|
||||
if (prefab == null || caster == null) return;
|
||||
|
||||
Vector3 spawnPos = GetSpawnPosition(caster, target) + spawnOffset;
|
||||
Quaternion spawnRot = GetSpawnRotation(caster, target);
|
||||
GameObject resolvedTarget = ResolveTarget(caster, target);
|
||||
Vector3 spawnPos = GetSpawnPosition(caster, resolvedTarget) + spawnOffset;
|
||||
Quaternion spawnRot = GetSpawnRotation(caster, resolvedTarget);
|
||||
|
||||
var networkObject = prefab.GetComponent<NetworkObject>();
|
||||
if (networkObject != null)
|
||||
@@ -55,6 +60,20 @@ namespace Colosseum.Skills.Effects
|
||||
}
|
||||
}
|
||||
|
||||
private GameObject ResolveTarget(GameObject caster, GameObject target)
|
||||
{
|
||||
if (!useCombatContextTarget)
|
||||
return target;
|
||||
|
||||
if (target != null && target != caster)
|
||||
return target;
|
||||
|
||||
BossCombatBehaviorContext context = caster.GetComponent<BossCombatBehaviorContext>();
|
||||
return context != null && context.CurrentTarget != null
|
||||
? context.CurrentTarget
|
||||
: target;
|
||||
}
|
||||
|
||||
private Vector3 GetSpawnPosition(GameObject caster, GameObject target)
|
||||
{
|
||||
return spawnLocation switch
|
||||
@@ -68,10 +87,13 @@ namespace Colosseum.Skills.Effects
|
||||
|
||||
private Quaternion GetSpawnRotation(GameObject caster, GameObject target)
|
||||
{
|
||||
if (spawnLocation == SpawnLocation.Target && target != null)
|
||||
if (target != null && (spawnLocation == SpawnLocation.Target || spawnLocation == SpawnLocation.CasterForward))
|
||||
{
|
||||
return Quaternion.LookRotation(target.transform.position - caster.transform.position);
|
||||
Vector3 lookDirection = target.transform.position - caster.transform.position;
|
||||
if (lookDirection.sqrMagnitude > 0.0001f)
|
||||
return Quaternion.LookRotation(lookDirection);
|
||||
}
|
||||
|
||||
return caster.transform.rotation;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
using Colosseum.Enemy;
|
||||
|
||||
namespace Colosseum.UI
|
||||
@@ -42,7 +43,7 @@ namespace Colosseum.UI
|
||||
// 보스 이름 표시
|
||||
if (bossNameText != null && BossEnemy.ActiveBoss != null)
|
||||
{
|
||||
bossNameText.text = $"{BossEnemy.ActiveBoss.name} Defeated!";
|
||||
bossNameText.text = BuildBossVictoryText(BossEnemy.ActiveBoss);
|
||||
}
|
||||
|
||||
// 애니메이션 재생
|
||||
@@ -51,5 +52,20 @@ namespace Colosseum.UI
|
||||
animator.SetTrigger("Show");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 승리 UI에 표시할 보스 이름 문구를 생성합니다.
|
||||
/// </summary>
|
||||
private static string BuildBossVictoryText(BossEnemy boss)
|
||||
{
|
||||
if (boss == null)
|
||||
return string.Empty;
|
||||
|
||||
string bossName = boss.Data != null && !string.IsNullOrWhiteSpace(boss.Data.EnemyName)
|
||||
? boss.Data.EnemyName
|
||||
: boss.name;
|
||||
|
||||
return $"{bossName} 격파";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user