Added Behavior Graph asset for AI simulations

This commit is contained in:
2026-04-28 18:33:07 +02:00
parent 8b1a42ed9d
commit 7e2030155c
34 changed files with 4361 additions and 8 deletions
+46
View File
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace DefaultNamespace.BehaviorTree
{
public class Tree : MonoBehaviour
{
private Node _rootNode;
// may be you want to run this tree anyways without looking for
// the current state, then throw the ifs away
private void OnEnable()
{
// create first node
_rootNode = new Sequence(new List<Node>());
//if (_rootNode.OnStart() == Status.Failure) enabled = false;
Debug.Log($"Root node status at start: {_rootNode.OnStart()}");
}
private void OnDisable()
{
_rootNode.OnEnd();
}
private void Update()
{
// Status status = _rootNode.OnUpdate();
//
// switch (status)
// {
// case Status.Success:
// break;
// case Status.Failure:
// break;
// case Status.Running:
// break;
// default:
// throw new ArgumentOutOfRangeException();
// }
Debug.Log($"Root node status at update: {_rootNode.OnUpdate()}");
}
}
}