first commit

This commit is contained in:
Chris
2025-03-12 14:22:16 -04:00
commit 0ad0c01249
1999 changed files with 189708 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.BehaviourTrees
{
[Name("Action")]
[Description("Executes an action and returns Success or Failure when the action is finished.\nReturns Running until the action is finished.")]
[ParadoxNotion.Design.Icon("Action")]
// [Color("ff6d53")]
public class ActionNode : BTNode, ITaskAssignable<ActionTask>
{
[SerializeField]
private ActionTask _action;
public Task task {
get { return action; }
set { action = (ActionTask)value; }
}
public ActionTask action {
get { return _action; }
set { _action = value; }
}
public override string name {
get { return base.name.ToUpper(); }
}
protected override Status OnExecute(Component agent, IBlackboard blackboard) {
if ( action == null ) {
return Status.Optional;
}
if ( status == Status.Resting || status == Status.Running ) {
return action.Execute(agent, blackboard);
}
return status;
}
protected override void OnReset() {
if ( action != null ) {
action.EndAction(null);
}
}
public override void OnGraphPaused() {
if ( action != null ) {
action.Pause();
}
}
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 4363f6a82c42c2f4db123b8c19215466
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
AssetOrigin:
serializedVersion: 1
productId: 14914
packageName: NodeCanvas
packageVersion: 3.3.1
assetPath: Assets/ParadoxNotion/NodeCanvas/Modules/BehaviourTrees/Nodes/Leafs/ActionNode.cs
uploadId: 704937

View File

@@ -0,0 +1,49 @@
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.BehaviourTrees
{
[Name("Condition")]
[Description("Checks a condition and returns Success or Failure.")]
[ParadoxNotion.Design.Icon("Condition")]
// [Color("ff6d53")]
public class ConditionNode : BTNode, ITaskAssignable<ConditionTask>
{
[SerializeField]
private ConditionTask _condition;
public Task task {
get { return condition; }
set { condition = (ConditionTask)value; }
}
public ConditionTask condition {
get { return _condition; }
set { _condition = value; }
}
public override string name {
get { return base.name.ToUpper(); }
}
protected override Status OnExecute(Component agent, IBlackboard blackboard) {
if ( condition == null ) {
return Status.Optional;
}
if ( status == Status.Resting ) {
condition.Enable(agent, blackboard);
}
return condition.Check(agent, blackboard) ? Status.Success : Status.Failure;
}
protected override void OnReset() {
if ( condition != null ) { condition.Disable(); }
}
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: ebacb7ee0473cac4a9a9de550ee34c08
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
AssetOrigin:
serializedVersion: 1
productId: 14914
packageName: NodeCanvas
packageVersion: 3.3.1
assetPath: Assets/ParadoxNotion/NodeCanvas/Modules/BehaviourTrees/Nodes/Leafs/ConditionNode.cs
uploadId: 704937

View File

@@ -0,0 +1,55 @@
using NodeCanvas.DialogueTrees;
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.BehaviourTrees
{
[Name("Sub Dialogue")]
[Description("Executes a sub Dialogue Tree. Returns Running while the sub Dialogue Tree is active. You can Finish the Dialogue Tree with the 'Finish' node and return Success or Failure.")]
[ParadoxNotion.Design.Icon("Dialogue")]
[DropReferenceType(typeof(DialogueTree))]
public class NestedDT : BTNodeNested<DialogueTree>
{
[SerializeField, ExposeField, Name("Sub Tree")]
private BBParameter<DialogueTree> _nestedDialogueTree = null;
public override DialogueTree subGraph { get { return _nestedDialogueTree.value; } set { _nestedDialogueTree.value = value; } }
public override BBParameter subGraphParameter => _nestedDialogueTree;
//
protected override Status OnExecute(Component agent, IBlackboard blackboard) {
if ( subGraph == null || subGraph.primeNode == null ) {
return Status.Optional;
}
if ( status == Status.Resting ) {
status = Status.Running;
this.TryStartSubGraph(agent, OnDLGFinished);
}
if ( status == Status.Running ) {
currentInstance.UpdateGraph(this.graph.deltaTime);
}
return status;
}
void OnDLGFinished(bool success) {
if ( status == Status.Running ) {
status = success ? Status.Success : Status.Failure;
}
}
protected override void OnReset() {
if ( currentInstance != null ) {
currentInstance.Stop();
}
}
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: d1bc8dfa829907d4587851859ad68a5b
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
AssetOrigin:
serializedVersion: 1
productId: 14914
packageName: NodeCanvas
packageVersion: 3.3.1
assetPath: Assets/ParadoxNotion/NodeCanvas/Modules/BehaviourTrees/Nodes/Leafs/NestedDT.cs
uploadId: 704937

View File

@@ -0,0 +1,83 @@
using System.Linq;
using NodeCanvas.Framework;
using NodeCanvas.StateMachines;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.BehaviourTrees
{
[Name("Sub FSM")]
[Description("Executes a sub FSM. Returns Running while the sub FSM is active. If a Success or Failure State is selected, then it will return Success or Failure as soon as the Nested FSM enters that state at which point the sub FSM will also be stoped. If the sub FSM ends otherwise, this node will return Success.")]
[ParadoxNotion.Design.Icon("FSM")]
[DropReferenceType(typeof(FSM))]
public class NestedFSM : BTNodeNested<FSM>
{
[SerializeField, ExposeField, Name("Sub FSM")]
private BBParameter<FSM> _nestedFSM = null;
[HideInInspector] public string successState;
[HideInInspector] public string failureState;
public override FSM subGraph { get { return _nestedFSM.value; } set { _nestedFSM.value = value; } }
public override BBParameter subGraphParameter => _nestedFSM;
///----------------------------------------------------------------------------------------------
protected override Status OnExecute(Component agent, IBlackboard blackboard) {
if ( subGraph == null || subGraph.primeNode == null ) {
return Status.Optional;
}
if ( status == Status.Resting ) {
status = Status.Running;
this.TryStartSubGraph(agent, OnFSMFinish);
}
if ( status == Status.Running ) {
currentInstance.UpdateGraph(this.graph.deltaTime);
}
if ( !string.IsNullOrEmpty(successState) && currentInstance.currentStateName == successState ) {
currentInstance.Stop(true);
return Status.Success;
}
if ( !string.IsNullOrEmpty(failureState) && currentInstance.currentStateName == failureState ) {
currentInstance.Stop(false);
return Status.Failure;
}
return status;
}
void OnFSMFinish(bool success) {
if ( status == Status.Running ) {
status = success ? Status.Success : Status.Failure;
}
}
protected override void OnReset() {
if ( currentInstance != null ) {
currentInstance.Stop();
}
}
///----------------------------------------------------------------------------------------------
///---------------------------------------UNITY EDITOR-------------------------------------------
#if UNITY_EDITOR
protected override void OnNodeInspectorGUI() {
base.OnNodeInspectorGUI();
if ( subGraph != null ) {
successState = EditorUtils.Popup<string>("Success State", successState, subGraph.GetStateNames());
failureState = EditorUtils.Popup<string>("Failure State", failureState, subGraph.GetStateNames());
}
}
#endif
///----------------------------------------------------------------------------------------------
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 029908fbea5cdb44eb8daab6ea1ce96d
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
AssetOrigin:
serializedVersion: 1
productId: 14914
packageName: NodeCanvas
packageVersion: 3.3.1
assetPath: Assets/ParadoxNotion/NodeCanvas/Modules/BehaviourTrees/Nodes/Leafs/NestedFSM.cs
uploadId: 704937

View File

@@ -0,0 +1,49 @@
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.BehaviourTrees
{
[Name("Sub Tree")]
[Description("Executes a sub Behaviour Tree. The status of the root node in the SubTree will be returned.")]
[ParadoxNotion.Design.Icon("BT")]
[DropReferenceType(typeof(BehaviourTree))]
public class SubTree : BTNodeNested<BehaviourTree>
{
[SerializeField, ExposeField]
private BBParameter<BehaviourTree> _subTree = null;
public override BehaviourTree subGraph { get { return _subTree.value; } set { _subTree.value = value; } }
public override BBParameter subGraphParameter => _subTree;
///----------------------------------------------------------------------------------------------
protected override Status OnExecute(Component agent, IBlackboard blackboard) {
if ( subGraph == null || subGraph.primeNode == null ) {
return Status.Optional;
}
if ( status == Status.Resting ) {
this.TryStartSubGraph(agent);
}
currentInstance.UpdateGraph(this.graph.deltaTime);
if ( currentInstance.repeat && currentInstance.rootStatus != Status.Running ) {
this.TryReadAndUnbindMappedVariables();
}
return currentInstance.rootStatus;
}
protected override void OnReset() {
if ( currentInstance != null ) {
currentInstance.Stop();
}
}
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 81a47db377388e443b24ae90ce6a83c8
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
AssetOrigin:
serializedVersion: 1
productId: 14914
packageName: NodeCanvas
packageVersion: 3.3.1
assetPath: Assets/ParadoxNotion/NodeCanvas/Modules/BehaviourTrees/Nodes/Leafs/SubTree.cs
uploadId: 704937