Ultraworked with [Sisyphus](https://github.com/code-yeonggu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
36 lines
939 B
C#
36 lines
939 B
C#
using System;
|
|
using Unity.Behavior;
|
|
using UnityEngine;
|
|
using Action = Unity.Behavior.Action;
|
|
using Unity.Properties;
|
|
|
|
[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 foundTarget = GameObject.FindGameObjectWithTag(Tag.Value);
|
|
|
|
if (foundTarget == null)
|
|
{
|
|
return Status.Failure;
|
|
}
|
|
|
|
Target.Value = foundTarget;
|
|
return Status.Success;
|
|
}
|
|
}
|
|
|