[AI] Behavior Actions 시스템 추가
Ultraworked with [Sisyphus](https://github.com/code-yeonggu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user