[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:
31
Assets/Scripts/AI/BehaviorActions/Actions/WaitAction.cs
Normal file
31
Assets/Scripts/AI/BehaviorActions/Actions/WaitAction.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using Unity.Behavior;
|
||||
using UnityEngine;
|
||||
using Action = Unity.Behavior.Action;
|
||||
using Unity.Properties;
|
||||
|
||||
[Serializable, GeneratePropertyBag]
|
||||
[NodeDescription(name: "Wait", story: "대기", category: "Action", id: "73b84bd4bc0eb61c998ac84c9853a69d")]
|
||||
public partial class WaitAction : Action
|
||||
{
|
||||
[SerializeReference]
|
||||
public BlackboardVariable<float> Duration = new BlackboardVariable<float>(1f);
|
||||
|
||||
private float startTime;
|
||||
|
||||
protected override Status OnStart()
|
||||
{
|
||||
startTime = Time.time;
|
||||
return Status.Running;
|
||||
}
|
||||
|
||||
protected override Status OnUpdate()
|
||||
{
|
||||
if (Time.time - startTime >= Duration.Value)
|
||||
{
|
||||
return Status.Success;
|
||||
}
|
||||
return Status.Running;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user