- FindTargetAction: IDamageable.IsDead 체크로 사망한 타겟 제외 - SetTargetInRangeAction: 사망한 타겟을 거리 검색에서 제외 - HasTargetCondition: 타겟 생존 여부 추가 확인 - BossArea: FindObjectOfType → FindFirstObjectByType 변경 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
38 lines
1.0 KiB
C#
38 lines
1.0 KiB
C#
using System;
|
|
using UnityEngine;
|
|
using Unity.Behavior;
|
|
using Unity.Properties;
|
|
using Condition = Unity.Behavior.Condition;
|
|
using Colosseum.Combat;
|
|
|
|
namespace Colosseum.AI.BehaviorActions.Conditions
|
|
{
|
|
/// <summary>
|
|
/// 타겟이 존재하고 살아있는지 확인합니다.
|
|
/// </summary>
|
|
[Serializable, GeneratePropertyBag]
|
|
[NodeDescription(name: "Has Target", story: "Has [Target]", category: "Combat")]
|
|
public partial class HasTargetCondition : Condition
|
|
{
|
|
[SerializeReference]
|
|
public BlackboardVariable<GameObject> Target;
|
|
|
|
public override bool IsTrue()
|
|
{
|
|
if (Target.Value == null || !Target.Value.activeInHierarchy)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
// 타겟이 사망했는지 확인
|
|
IDamageable damageable = Target.Value.GetComponent<IDamageable>();
|
|
if (damageable != null && damageable.IsDead)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
}
|