- Assets/_Game/ 하위로 게임 에셋 통합 - External/ 패키지 벤더별 분류 (Synty, Animations, UI) - 에셋 네이밍 컨벤션 확립 및 적용 (Data_Skill_, Data_SkillEffect_, Prefab_, Anim_, Model_, BT_ 등) - pre-commit hook으로 네이밍 컨벤션 자동 검사 추가 - RESTRUCTURE_CHECKLIST.md 작성 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
51 lines
1.5 KiB
C#
51 lines
1.5 KiB
C#
using System;
|
|
using Unity.Behavior;
|
|
using UnityEngine;
|
|
using Action = Unity.Behavior.Action;
|
|
using Unity.Properties;
|
|
using Colosseum.Combat;
|
|
|
|
[Serializable, GeneratePropertyBag]
|
|
[NodeDescription(name: "FindTarget", story: "[타겟] 탐색", category: "Action", id: "bb947540549026f3c5625c6d19213311")]
|
|
public partial class FindTargetAction : Action
|
|
{
|
|
[SerializeReference]
|
|
public BlackboardVariable<GameObject> Target;
|
|
|
|
[SerializeReference]
|
|
public BlackboardVariable<string> Tag = new BlackboardVariable<string>("Player");
|
|
|
|
protected override Status OnStart()
|
|
{
|
|
if (Tag.Value == null || string.IsNullOrEmpty(Tag.Value))
|
|
{
|
|
return Status.Failure;
|
|
}
|
|
|
|
// 모든 타겟 후보 검색
|
|
GameObject[] candidates = GameObject.FindGameObjectsWithTag(Tag.Value);
|
|
|
|
if (candidates == null || candidates.Length == 0)
|
|
{
|
|
return Status.Failure;
|
|
}
|
|
|
|
// 사망하지 않은 타겟 찾기
|
|
foreach (GameObject candidate in candidates)
|
|
{
|
|
IDamageable damageable = candidate.GetComponent<IDamageable>();
|
|
|
|
// IDamageable이 없거나 살아있는 경우 타겟으로 선택
|
|
if (damageable == null || !damageable.IsDead)
|
|
{
|
|
Target.Value = candidate;
|
|
return Status.Success;
|
|
}
|
|
}
|
|
|
|
// 살아있는 타겟이 없음
|
|
return Status.Failure;
|
|
}
|
|
}
|
|
|