chore: Assets 디렉토리 구조 정리 및 네이밍 컨벤션 적용
- 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>
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using Unity.Behavior;
|
||||
using UnityEngine;
|
||||
using Action = Unity.Behavior.Action;
|
||||
using Unity.Properties;
|
||||
using Colosseum.Combat;
|
||||
|
||||
[Serializable, GeneratePropertyBag]
|
||||
[NodeDescription(name: "SetTargetInRange", story: "[거리] 내에 [대상이] 있는지 확인", category: "Action", id: "93b7a5d823a58618d5371c01ef894948")]
|
||||
public partial class SetTargetInRangeAction : Action
|
||||
{
|
||||
[SerializeReference]
|
||||
public BlackboardVariable<GameObject> Target;
|
||||
|
||||
[SerializeReference]
|
||||
public BlackboardVariable<string> Tag = new BlackboardVariable<string>("Player");
|
||||
|
||||
[SerializeReference]
|
||||
public BlackboardVariable<float> Range = new BlackboardVariable<float>(10f);
|
||||
|
||||
protected override Status OnStart()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Tag.Value))
|
||||
{
|
||||
return Status.Failure;
|
||||
}
|
||||
|
||||
// 모든 타겟 태그 오브젝트 찾기
|
||||
GameObject[] targets = GameObject.FindGameObjectsWithTag(Tag.Value);
|
||||
|
||||
if (targets == null || targets.Length == 0)
|
||||
{
|
||||
return Status.Failure;
|
||||
}
|
||||
|
||||
// 가장 가까운 살아있는 타겟 찾기
|
||||
GameObject nearestTarget = null;
|
||||
float nearestDistance = Range.Value; // Range 내에서만 검색
|
||||
|
||||
foreach (GameObject potentialTarget in targets)
|
||||
{
|
||||
// 사망한 타겟은 제외
|
||||
IDamageable damageable = potentialTarget.GetComponent<IDamageable>();
|
||||
if (damageable != null && damageable.IsDead)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
float distance = Vector3.Distance(
|
||||
GameObject.transform.position,
|
||||
potentialTarget.transform.position
|
||||
);
|
||||
|
||||
if (distance < nearestDistance)
|
||||
{
|
||||
nearestDistance = distance;
|
||||
nearestTarget = potentialTarget;
|
||||
}
|
||||
}
|
||||
|
||||
if (nearestTarget == null)
|
||||
{
|
||||
return Status.Failure;
|
||||
}
|
||||
|
||||
Target.Value = nearestTarget;
|
||||
return Status.Success;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user