[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,33 @@
|
||||
using System;
|
||||
using Unity.Behavior;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using Action = Unity.Behavior.Action;
|
||||
using Unity.Properties;
|
||||
|
||||
[Serializable, GeneratePropertyBag]
|
||||
[NodeDescription(name: "SetAnimatorTrigger", story: "애니메이션 [트리거] 설정", category: "Action", id: "bfef104cbd43df3d01f24570a4caa8ed")]
|
||||
public partial class SetAnimatorTriggerAction : Action
|
||||
{
|
||||
[SerializeReference]
|
||||
public BlackboardVariable<string> TriggerName = new BlackboardVariable<string>("");
|
||||
|
||||
protected override Status OnStart()
|
||||
{
|
||||
if (string.IsNullOrEmpty(TriggerName.Value))
|
||||
{
|
||||
return Status.Failure;
|
||||
}
|
||||
|
||||
Animator animator = GameObject.GetComponentInChildren<Animator>();
|
||||
|
||||
if (animator == null)
|
||||
{
|
||||
return Status.Failure;
|
||||
}
|
||||
|
||||
animator.SetTrigger(TriggerName.Value);
|
||||
return Status.Success;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user