Added Behavior Graph asset for Unity

This commit is contained in:
2026-04-28 12:35:51 +02:00
parent a3c7859b18
commit 2b213f359b
34 changed files with 5079 additions and 9 deletions
+66
View File
@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace BehaviorTree
{
public class Tree : MonoBehaviour
{
private Node _rootNode;
private void OnEnable()
{
_rootNode = new Selector(new List<Node>{});
Status status = _rootNode.Start();
Debug.Log(status);
switch (status)
{
case Status.Success:
break;
case Status.Failure:
break;
case Status.Running:
break;
default:
throw new ArgumentOutOfRangeException();
}
}
private void OnDisable()
{
Status status = _rootNode?.End() ?? Status.Failure;
switch (status)
{
case Status.Success:
break;
case Status.Failure:
break;
case Status.Running:
break;
default:
throw new ArgumentOutOfRangeException();
}
_rootNode = null;
}
private void Update()
{
Status status = _rootNode?.Update() ?? Status.Failure;
switch (status)
{
case Status.Success:
break;
case Status.Failure:
break;
case Status.Running:
break;
default:
throw new ArgumentOutOfRangeException();
}
}
}
}