diff --git a/AI/Assets/Scripts/BehaviorTree.meta b/AI/Assets/Scripts/BehaviorTree.meta new file mode 100644 index 0000000..2fc741c --- /dev/null +++ b/AI/Assets/Scripts/BehaviorTree.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 2c6bdc0b9db0433e939c2e77844106f1 +timeCreated: 1745402938 \ No newline at end of file diff --git a/AI/Assets/Scripts/BehaviorTree/Action.cs b/AI/Assets/Scripts/BehaviorTree/Action.cs new file mode 100644 index 0000000..81069c4 --- /dev/null +++ b/AI/Assets/Scripts/BehaviorTree/Action.cs @@ -0,0 +1,9 @@ +namespace DefaultNamespace.BehaviorTree +{ + public abstract class Action : Node + { + public Action() + { + } + } +} \ No newline at end of file diff --git a/AI/Assets/Scripts/BehaviorTree/Action.cs.meta b/AI/Assets/Scripts/BehaviorTree/Action.cs.meta new file mode 100644 index 0000000..b07fa67 --- /dev/null +++ b/AI/Assets/Scripts/BehaviorTree/Action.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d658db48a0944051aa2a4a2fa02e089c +timeCreated: 1745403146 \ No newline at end of file diff --git a/AI/Assets/Scripts/BehaviorTree/Composite.cs b/AI/Assets/Scripts/BehaviorTree/Composite.cs new file mode 100644 index 0000000..5d8fa1d --- /dev/null +++ b/AI/Assets/Scripts/BehaviorTree/Composite.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace DefaultNamespace.BehaviorTree +{ + public class Composite : Node + { + public Composite(List nodes) + { + _nodes.AddRange(nodes); + } + + public Composite(params Node[] nodes) + { + _nodes.AddRange(nodes); + } + } +} \ No newline at end of file diff --git a/AI/Assets/Scripts/BehaviorTree/Composite.cs.meta b/AI/Assets/Scripts/BehaviorTree/Composite.cs.meta new file mode 100644 index 0000000..93406fb --- /dev/null +++ b/AI/Assets/Scripts/BehaviorTree/Composite.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 975b1d6c26eb459d9a8cdd3e042b6674 +timeCreated: 1745403206 \ No newline at end of file diff --git a/AI/Assets/Scripts/BehaviorTree/Condition.cs b/AI/Assets/Scripts/BehaviorTree/Condition.cs new file mode 100644 index 0000000..8d81343 --- /dev/null +++ b/AI/Assets/Scripts/BehaviorTree/Condition.cs @@ -0,0 +1,7 @@ +namespace DefaultNamespace.BehaviorTree +{ + public abstract class Condition : Action + { + + } +} \ No newline at end of file diff --git a/AI/Assets/Scripts/BehaviorTree/Condition.cs.meta b/AI/Assets/Scripts/BehaviorTree/Condition.cs.meta new file mode 100644 index 0000000..420a6d6 --- /dev/null +++ b/AI/Assets/Scripts/BehaviorTree/Condition.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a2d064fe5d964df7aa50ae36e8551561 +timeCreated: 1745403415 \ No newline at end of file diff --git a/AI/Assets/Scripts/BehaviorTree/Decorator.cs b/AI/Assets/Scripts/BehaviorTree/Decorator.cs new file mode 100644 index 0000000..2d6e18f --- /dev/null +++ b/AI/Assets/Scripts/BehaviorTree/Decorator.cs @@ -0,0 +1,19 @@ +namespace DefaultNamespace.BehaviorTree +{ + public class Decorator : Node + { + public Node Node + { + get + { + if (_nodes != null && _nodes.Count > 0) return _nodes[0]; + return null; + } + } + + public Decorator(Node node) + { + _nodes.Add(node); + } + } +} \ No newline at end of file diff --git a/AI/Assets/Scripts/BehaviorTree/Decorator.cs.meta b/AI/Assets/Scripts/BehaviorTree/Decorator.cs.meta new file mode 100644 index 0000000..bed984c --- /dev/null +++ b/AI/Assets/Scripts/BehaviorTree/Decorator.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f064dd30dc4940009b32f253d2f6ec34 +timeCreated: 1745403277 \ No newline at end of file diff --git a/AI/Assets/Scripts/BehaviorTree/Node.cs b/AI/Assets/Scripts/BehaviorTree/Node.cs new file mode 100644 index 0000000..3ba5c79 --- /dev/null +++ b/AI/Assets/Scripts/BehaviorTree/Node.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; + +namespace DefaultNamespace.BehaviorTree +{ + public abstract class Node + { + protected List _nodes = new(); + + public virtual void Start() + { + + } + + public virtual Status Update() + { + return Status.Success; + } + + public virtual void End() + { + + } + } + + public enum Status + { + Success, + Failure, + Running, + } +} \ No newline at end of file diff --git a/AI/Assets/Scripts/BehaviorTree/Node.cs.meta b/AI/Assets/Scripts/BehaviorTree/Node.cs.meta new file mode 100644 index 0000000..3b3f12d --- /dev/null +++ b/AI/Assets/Scripts/BehaviorTree/Node.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: bb191187e8a246b29358c9eca60e18ea +timeCreated: 1745403053 \ No newline at end of file diff --git a/AI/Assets/Scripts/BehaviorTree/Sequence.cs b/AI/Assets/Scripts/BehaviorTree/Sequence.cs new file mode 100644 index 0000000..3eee787 --- /dev/null +++ b/AI/Assets/Scripts/BehaviorTree/Sequence.cs @@ -0,0 +1,42 @@ +using System; + +namespace DefaultNamespace.BehaviorTree +{ + public class Sequence : Composite + { + protected int _currentIndex; + protected Node _currentNode; + + public override void Start() + { + _currentIndex = 0; + _currentNode = _currentIndex >= _nodes.Count ? null : _nodes[_currentIndex]; + _currentNode?.Start(); + } + + public override Status Update() + { + if (_currentNode == null) return Status.Failure; + + Status status = _currentNode.Update(); + + switch (status) + { + case Status.Success: + _currentNode.End(); + _currentIndex++; + if (_currentIndex >= _nodes.Count) return Status.Success; + _currentNode = _nodes[_currentIndex]; + _currentNode.Start(); + return Status.Running; + case Status.Failure: + _currentNode.End(); + return Status.Failure; + case Status.Running: + return Status.Running; + default: + throw new ArgumentOutOfRangeException(); + } + } + } +} \ No newline at end of file diff --git a/AI/Assets/Scripts/BehaviorTree/Sequence.cs.meta b/AI/Assets/Scripts/BehaviorTree/Sequence.cs.meta new file mode 100644 index 0000000..3ff9b62 --- /dev/null +++ b/AI/Assets/Scripts/BehaviorTree/Sequence.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 39476da0e0a54e429221ed45a8c2cf0f +timeCreated: 1745403452 \ No newline at end of file diff --git a/AI/Assets/Scripts/BehaviorTree/Tree.cs b/AI/Assets/Scripts/BehaviorTree/Tree.cs new file mode 100644 index 0000000..b2b308d --- /dev/null +++ b/AI/Assets/Scripts/BehaviorTree/Tree.cs @@ -0,0 +1,28 @@ +using System; +using UnityEngine; + +namespace DefaultNamespace.BehaviorTree +{ + public class Tree : MonoBehaviour + { + private Node _rootNode; + + private void OnEnable() + { + if (_rootNode == null) return; + _rootNode.Start(); + } + + private void Update() + { + if (_rootNode == null) return; + _rootNode.Update(); + } + + private void OnDisable() + { + if (_rootNode == null) return; + _rootNode.End(); + } + } +} \ No newline at end of file diff --git a/AI/Assets/Scripts/BehaviorTree/Tree.cs.meta b/AI/Assets/Scripts/BehaviorTree/Tree.cs.meta new file mode 100644 index 0000000..104a4c0 --- /dev/null +++ b/AI/Assets/Scripts/BehaviorTree/Tree.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1de9a2c205bb40fb9770d0639fb89abe +timeCreated: 1745402959 \ No newline at end of file diff --git a/AI/Packages/manifest.json b/AI/Packages/manifest.json index 27738cd..f0870eb 100644 --- a/AI/Packages/manifest.json +++ b/AI/Packages/manifest.json @@ -1,10 +1,11 @@ { "dependencies": { - "com.unity.ai.navigation": "2.0.6", + "com.unity.ai.navigation": "2.0.7", + "com.unity.behavior": "1.0.9", "com.unity.collab-proxy": "2.7.1", - "com.unity.ide.rider": "3.0.31", - "com.unity.ide.visualstudio": "2.0.22", - "com.unity.inputsystem": "1.13.1", + "com.unity.ide.rider": "3.0.35", + "com.unity.ide.visualstudio": "2.0.23", + "com.unity.inputsystem": "1.14.0", "com.unity.multiplayer.center": "1.0.0", "com.unity.render-pipelines.universal": "17.0.4", "com.unity.test-framework": "1.5.1", diff --git a/AI/Packages/packages-lock.json b/AI/Packages/packages-lock.json index 5dc69f7..1fe0a20 100644 --- a/AI/Packages/packages-lock.json +++ b/AI/Packages/packages-lock.json @@ -1,7 +1,7 @@ { "dependencies": { "com.unity.ai.navigation": { - "version": "2.0.6", + "version": "2.0.7", "depth": 0, "source": "registry", "dependencies": { @@ -9,9 +9,26 @@ }, "url": "https://packages.unity.com" }, + "com.unity.behavior": { + "version": "1.0.9", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.burst": "1.7.2", + "com.unity.dt.app-ui": "2.0.0-pre.16", + "com.unity.modules.ai": "1.0.0", + "com.unity.collections": "2.1.4", + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.animation": "1.0.0", + "com.unity.nuget.newtonsoft-json": "3.2.1", + "com.unity.modules.particlesystem": "1.0.0", + "com.unity.modules.unitywebrequest": "1.0.0" + }, + "url": "https://packages.unity.com" + }, "com.unity.burst": { - "version": "1.8.19", - "depth": 2, + "version": "1.8.21", + "depth": 1, "source": "registry", "dependencies": { "com.unity.mathematics": "1.2.1", @@ -28,7 +45,7 @@ }, "com.unity.collections": { "version": "2.5.1", - "depth": 2, + "depth": 1, "source": "registry", "dependencies": { "com.unity.burst": "1.8.17", @@ -38,6 +55,18 @@ }, "url": "https://packages.unity.com" }, + "com.unity.dt.app-ui": { + "version": "2.0.0-pre.16", + "depth": 1, + "source": "registry", + "dependencies": { + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.androidjni": "1.0.0", + "com.unity.modules.uielements": "1.0.0", + "com.unity.modules.screencapture": "1.0.0" + }, + "url": "https://packages.unity.com" + }, "com.unity.ext.nunit": { "version": "2.0.5", "depth": 1, @@ -45,7 +74,7 @@ "dependencies": {} }, "com.unity.ide.rider": { - "version": "3.0.31", + "version": "3.0.35", "depth": 0, "source": "registry", "dependencies": { @@ -54,7 +83,7 @@ "url": "https://packages.unity.com" }, "com.unity.ide.visualstudio": { - "version": "2.0.22", + "version": "2.0.23", "depth": 0, "source": "registry", "dependencies": { @@ -63,7 +92,7 @@ "url": "https://packages.unity.com" }, "com.unity.inputsystem": { - "version": "1.13.1", + "version": "1.14.0", "depth": 0, "source": "registry", "dependencies": { @@ -88,7 +117,14 @@ }, "com.unity.nuget.mono-cecil": { "version": "1.11.4", - "depth": 3, + "depth": 2, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, + "com.unity.nuget.newtonsoft-json": { + "version": "3.2.1", + "depth": 1, "source": "registry", "dependencies": {}, "url": "https://packages.unity.com" @@ -179,11 +215,11 @@ } }, "com.unity.test-framework.performance": { - "version": "3.0.3", - "depth": 3, + "version": "3.1.0", + "depth": 2, "source": "registry", "dependencies": { - "com.unity.test-framework": "1.1.31", + "com.unity.test-framework": "1.1.33", "com.unity.modules.jsonserialize": "1.0.0" }, "url": "https://packages.unity.com" diff --git a/AI/ProjectSettings/EditorBuildSettings.asset b/AI/ProjectSettings/EditorBuildSettings.asset index d057ba3..b0dd257 100644 --- a/AI/ProjectSettings/EditorBuildSettings.asset +++ b/AI/ProjectSettings/EditorBuildSettings.asset @@ -9,5 +9,6 @@ EditorBuildSettings: path: Assets/Scenes/SampleScene.unity guid: 99c9720ab356a0642a771bea13969a05 m_configObjects: + com.unity.dt.app-ui: {fileID: 11400000, guid: 99f9c9493070a9d4c979a8fec7c5a8d3, type: 2} com.unity.input.settings.actions: {fileID: -944628639613478452, guid: 052faaac586de48259a63d0c4782560b, type: 3} m_UseUCBPForAssetBundles: 0 diff --git a/AI/ProjectSettings/ProjectVersion.txt b/AI/ProjectSettings/ProjectVersion.txt index 6a73247..7b22109 100644 --- a/AI/ProjectSettings/ProjectVersion.txt +++ b/AI/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 6000.0.44f1 -m_EditorVersionWithRevision: 6000.0.44f1 (101c91f3a8fb) +m_EditorVersion: 6000.0.47f1 +m_EditorVersionWithRevision: 6000.0.47f1 (2ad1ed33fd3b)