first commit
This commit is contained in:
@@ -0,0 +1,136 @@
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace NodeCanvas.StateMachines
|
||||
{
|
||||
|
||||
[Name("Parallel")]
|
||||
[Description("Execute a number of Actions with optional conditional requirement and in parallel to any other state, as soon as the FSM is started. All actions will prematurely be stoped as soon as the FSM stops as well. This is not a state.")]
|
||||
[Color("ff64cb")]
|
||||
[ParadoxNotion.Design.Icon("Repeat")]
|
||||
[System.Obsolete("Use On FSM Update node")]
|
||||
public class ConcurrentState : FSMNode, IUpdatable
|
||||
{
|
||||
|
||||
[SerializeField]
|
||||
private ConditionList _conditionList;
|
||||
[SerializeField]
|
||||
private ActionList _actionList;
|
||||
[SerializeField]
|
||||
private bool _repeatStateActions;
|
||||
|
||||
private bool done;
|
||||
|
||||
public ConditionList conditionList {
|
||||
get { return _conditionList; }
|
||||
set { _conditionList = value; }
|
||||
}
|
||||
|
||||
public ActionList actionList {
|
||||
get { return _actionList; }
|
||||
set { _actionList = value; }
|
||||
}
|
||||
|
||||
public bool repeatStateActions {
|
||||
get { return _repeatStateActions; }
|
||||
set { _repeatStateActions = value; }
|
||||
}
|
||||
|
||||
public override string name {
|
||||
get { return base.name.ToUpper(); }
|
||||
}
|
||||
|
||||
public override int maxInConnections { get { return 0; } }
|
||||
public override int maxOutConnections { get { return 0; } }
|
||||
public override bool allowAsPrime { get { return false; } }
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
|
||||
public override void OnValidate(Graph assignedGraph) {
|
||||
if ( conditionList == null ) {
|
||||
conditionList = (ConditionList)Task.Create(typeof(ConditionList), assignedGraph);
|
||||
conditionList.checkMode = ConditionList.ConditionsCheckMode.AllTrueRequired;
|
||||
}
|
||||
|
||||
if ( actionList == null ) {
|
||||
actionList = (ActionList)Task.Create(typeof(ActionList), assignedGraph);
|
||||
actionList.executionMode = ActionList.ActionsExecutionMode.ActionsRunInParallel;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnGraphStarted() {
|
||||
conditionList.Enable(graphAgent, graphBlackboard);
|
||||
done = false;
|
||||
}
|
||||
|
||||
public override void OnGraphStoped() {
|
||||
conditionList.Disable();
|
||||
actionList.EndAction(null);
|
||||
done = false;
|
||||
}
|
||||
|
||||
public override void OnGraphPaused() {
|
||||
actionList.Pause();
|
||||
}
|
||||
|
||||
void IUpdatable.Update() {
|
||||
|
||||
if ( done && !repeatStateActions ) {
|
||||
return;
|
||||
}
|
||||
|
||||
status = Status.Running;
|
||||
if ( conditionList.Check(graphAgent, graphBlackboard) ) {
|
||||
if ( actionList.Execute(graphAgent, graphBlackboard) != Status.Running ) {
|
||||
if ( !repeatStateActions ) { status = Status.Success; }
|
||||
done = true;
|
||||
}
|
||||
} else {
|
||||
actionList.EndAction(null);
|
||||
status = Status.Failure;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
///---------------------------------------UNITY EDITOR-------------------------------------------
|
||||
#if UNITY_EDITOR
|
||||
|
||||
protected override void OnNodeGUI() {
|
||||
if ( repeatStateActions ) {
|
||||
GUILayout.Label("<b>[REPEAT]</b>");
|
||||
}
|
||||
if ( conditionList.conditions.Count > 0 ) {
|
||||
GUILayout.BeginVertical(Styles.roundedBox);
|
||||
GUILayout.Label(conditionList.summaryInfo);
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
GUILayout.BeginVertical(Styles.roundedBox);
|
||||
GUILayout.Label(actionList.summaryInfo);
|
||||
GUILayout.EndVertical();
|
||||
|
||||
base.OnNodeGUI();
|
||||
}
|
||||
|
||||
protected override void OnNodeInspectorGUI() {
|
||||
|
||||
repeatStateActions = UnityEditor.EditorGUILayout.ToggleLeft("Repeat", repeatStateActions);
|
||||
EditorUtils.Separator();
|
||||
|
||||
EditorUtils.CoolLabel("Conditions (optional)");
|
||||
conditionList.ShowListGUI();
|
||||
conditionList.ShowNestedConditionsGUI();
|
||||
|
||||
EditorUtils.BoldSeparator();
|
||||
|
||||
EditorUtils.CoolLabel("Actions");
|
||||
actionList.ShowListGUI();
|
||||
actionList.ShowNestedActionsGUI();
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7043e91e31632a947a12f83fb7f72c26
|
||||
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/_DeprecatedFiles/Legacy_ConcurrentState.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,90 @@
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace NodeCanvas.StateMachines
|
||||
{
|
||||
|
||||
[Name("Enter | Exit")]
|
||||
[Description("Execute a number of Actions when the FSM enters/starts and when it exits/stops. This is not a state.")]
|
||||
[Color("ff64cb")]
|
||||
[ParadoxNotion.Design.Icon("MacroIn")]
|
||||
[System.Obsolete("Use On FSM Enter and On FSM Exit nodes")]
|
||||
public class EnterExitState : FSMNode, IUpdatable
|
||||
{
|
||||
|
||||
[SerializeField] private ActionList _actionListEnter;
|
||||
[SerializeField] private ActionList _actionListExit;
|
||||
|
||||
public ActionList actionListEnter {
|
||||
get { return _actionListEnter; }
|
||||
set { _actionListEnter = value; }
|
||||
}
|
||||
|
||||
public ActionList actionListExit {
|
||||
get { return _actionListExit; }
|
||||
set { _actionListExit = value; }
|
||||
}
|
||||
|
||||
public override string name => base.name.ToUpper();
|
||||
public override int maxInConnections => 0;
|
||||
public override int maxOutConnections => 0;
|
||||
public override bool allowAsPrime => false;
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
|
||||
public override void OnValidate(Graph assignedGraph) {
|
||||
if ( actionListEnter == null ) {
|
||||
actionListEnter = (ActionList)Task.Create(typeof(ActionList), assignedGraph);
|
||||
actionListEnter.executionMode = ActionList.ActionsExecutionMode.ActionsRunInParallel;
|
||||
}
|
||||
if ( actionListExit == null ) {
|
||||
actionListExit = (ActionList)Task.Create(typeof(ActionList), assignedGraph);
|
||||
actionListExit.executionMode = ActionList.ActionsExecutionMode.ActionsRunInParallel;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnGraphStarted() {
|
||||
status = actionListEnter.Execute(graphAgent, graphBlackboard);
|
||||
}
|
||||
|
||||
public override void OnGraphStoped() {
|
||||
actionListExit.Execute(graphAgent, graphBlackboard);
|
||||
actionListExit.EndAction(null);
|
||||
actionListEnter.EndAction(null);
|
||||
}
|
||||
|
||||
void IUpdatable.Update() {
|
||||
if ( status == Status.Running ) {
|
||||
status = actionListEnter.Execute(graphAgent, graphBlackboard);
|
||||
}
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
///---------------------------------------UNITY EDITOR-------------------------------------------
|
||||
#if UNITY_EDITOR
|
||||
|
||||
protected override void OnNodeGUI() {
|
||||
GUILayout.BeginVertical(Styles.roundedBox);
|
||||
GUILayout.Label(actionListEnter.summaryInfo);
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.BeginVertical(Styles.roundedBox);
|
||||
GUILayout.Label(actionListExit.summaryInfo);
|
||||
GUILayout.EndVertical();
|
||||
base.OnNodeGUI();
|
||||
}
|
||||
|
||||
protected override void OnNodeInspectorGUI() {
|
||||
EditorUtils.CoolLabel("FSM Enter Actions");
|
||||
actionListEnter.ShowListGUI();
|
||||
actionListEnter.ShowNestedActionsGUI();
|
||||
EditorUtils.BoldSeparator();
|
||||
EditorUtils.CoolLabel("FSM Exit Actions");
|
||||
actionListExit.ShowListGUI();
|
||||
actionListExit.ShowNestedActionsGUI();
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6062133671fd67143bb80f9cbe2ff297
|
||||
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/_DeprecatedFiles/Legacy_EnterExitState.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace NodeCanvas.Framework
|
||||
{
|
||||
|
||||
[System.AttributeUsage(System.AttributeTargets.Class)]
|
||||
[System.Obsolete("[EventReceiver] is no longer used. Please use the '.router' property to subscribe/unsubscribe to events (in OnExecute/OnStop for actions and OnEnable/OnDisable for conditions). For custom events, use '.router.onCustomEvent'.")]
|
||||
public class EventReceiverAttribute : System.Attribute
|
||||
{
|
||||
readonly public string[] eventMessages;
|
||||
public EventReceiverAttribute(params string[] args) {
|
||||
this.eventMessages = args;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f211ef59adfd7e42bef9c68cc1b3ebc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/NodeCanvas/_DeprecatedFiles/Legacy_EventReceiverAttribute.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,88 @@
|
||||
using System.Reflection;
|
||||
using NodeCanvas.Framework;
|
||||
using NodeCanvas.Framework.Internal;
|
||||
using ParadoxNotion;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace NodeCanvas.Tasks.Actions
|
||||
{
|
||||
|
||||
[System.Obsolete("Execute Function now supports static functions as well")]
|
||||
public class ExecuteStaticFunction : ActionTask, ISubParametersContainer
|
||||
{
|
||||
|
||||
[SerializeField]
|
||||
protected ReflectedWrapper functionWrapper;
|
||||
|
||||
BBParameter[] ISubParametersContainer.GetSubParameters() {
|
||||
return functionWrapper != null ? functionWrapper.GetVariables() : null;
|
||||
}
|
||||
|
||||
private MethodInfo targetMethod {
|
||||
get { return functionWrapper != null ? functionWrapper.GetMethod() : null; }
|
||||
}
|
||||
|
||||
protected override string info {
|
||||
get
|
||||
{
|
||||
if ( functionWrapper == null ) { return "No Method Selected"; }
|
||||
if ( targetMethod == null ) { return functionWrapper.AsString().FormatError(); }
|
||||
|
||||
var variables = functionWrapper.GetVariables();
|
||||
var returnInfo = "";
|
||||
var paramInfo = "";
|
||||
if ( targetMethod.ReturnType == typeof(void) ) {
|
||||
for ( var i = 0; i < variables.Length; i++ )
|
||||
paramInfo += ( i != 0 ? ", " : "" ) + variables[i].ToString();
|
||||
} else {
|
||||
returnInfo = variables[0].isNone ? "" : variables[0] + " = ";
|
||||
for ( var i = 1; i < variables.Length; i++ )
|
||||
paramInfo += ( i != 1 ? ", " : "" ) + variables[i].ToString();
|
||||
}
|
||||
|
||||
return string.Format("{0}{1}.{2} ({3})", returnInfo, targetMethod.DeclaringType.FriendlyName(), targetMethod.Name, paramInfo);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnValidate(ITaskSystem ownerSystem) {
|
||||
if ( functionWrapper != null && functionWrapper.HasChanged() ) {
|
||||
SetMethod(functionWrapper.GetMethod());
|
||||
}
|
||||
}
|
||||
|
||||
//store the method info on init
|
||||
protected override string OnInit() {
|
||||
if ( targetMethod == null ) { return "Missing Method"; }
|
||||
|
||||
try {
|
||||
functionWrapper.Init(null);
|
||||
return null;
|
||||
}
|
||||
catch { return "ExecuteFunction Error"; }
|
||||
}
|
||||
|
||||
//do it by calling delegate or invoking method
|
||||
protected override void OnExecute() {
|
||||
|
||||
if ( targetMethod == null ) {
|
||||
EndAction(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( functionWrapper is ReflectedActionWrapper ) {
|
||||
( functionWrapper as ReflectedActionWrapper ).Call();
|
||||
} else {
|
||||
( functionWrapper as ReflectedFunctionWrapper ).Call();
|
||||
}
|
||||
|
||||
EndAction();
|
||||
}
|
||||
|
||||
void SetMethod(MethodInfo method) {
|
||||
if ( method != null ) {
|
||||
functionWrapper = ReflectedWrapper.Create(method, blackboard);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f73bf3d16608f946b80aea1c9cc48dd
|
||||
timeCreated: 1427489894
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/NodeCanvas/_DeprecatedFiles/Legacy_ExecuteStaticFunction.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,85 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using NodeCanvas.Framework;
|
||||
using NodeCanvas.Framework.Internal;
|
||||
using ParadoxNotion;
|
||||
using ParadoxNotion.Serialization;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace NodeCanvas.Tasks.Actions
|
||||
{
|
||||
|
||||
[System.Obsolete("Execute Function now supports static functions as well")]
|
||||
public class ExecuteStaticFunction_Multiplatform : ActionTask
|
||||
{
|
||||
|
||||
[SerializeField]
|
||||
protected SerializedMethodInfo method;
|
||||
[SerializeField]
|
||||
protected List<BBObjectParameter> parameters = new List<BBObjectParameter>();
|
||||
[SerializeField]
|
||||
[BlackboardOnly]
|
||||
protected BBObjectParameter returnValue;
|
||||
|
||||
private MethodInfo targetMethod => method;
|
||||
|
||||
protected override string info {
|
||||
get
|
||||
{
|
||||
if ( method == null ) { return "No Method Selected"; }
|
||||
if ( targetMethod == null ) { return method.AsString().FormatError(); }
|
||||
|
||||
var returnInfo = targetMethod.ReturnType == typeof(void) ? "" : returnValue.ToString() + " = ";
|
||||
var paramInfo = "";
|
||||
for ( var i = 0; i < parameters.Count; i++ ) {
|
||||
paramInfo += ( i != 0 ? ", " : "" ) + parameters[i].ToString();
|
||||
}
|
||||
return string.Format("{0}{1}.{2} ({3})", returnInfo, targetMethod.DeclaringType.FriendlyName(), targetMethod.Name, paramInfo);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnValidate(ITaskSystem ownerSystem) {
|
||||
if ( method != null && method.HasChanged() ) { SetMethod(method); }
|
||||
}
|
||||
|
||||
//store the method info on init
|
||||
protected override string OnInit() {
|
||||
if ( method == null ) { return "No methMethodd selected"; }
|
||||
if ( targetMethod == null ) { return string.Format("Missing Method '{0}'", method.AsString()); }
|
||||
return null;
|
||||
}
|
||||
|
||||
//do it by calling delegate or invoking method
|
||||
protected override void OnExecute() {
|
||||
var args = parameters.Select(p => p.value).ToArray();
|
||||
returnValue.value = targetMethod.Invoke(agent, args);
|
||||
EndAction();
|
||||
}
|
||||
|
||||
|
||||
void SetMethod(MethodInfo method) {
|
||||
|
||||
if ( method == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.method = new SerializedMethodInfo(method);
|
||||
this.parameters.Clear();
|
||||
foreach ( var p in method.GetParameters() ) {
|
||||
var newParam = new BBObjectParameter(p.ParameterType) { bb = blackboard };
|
||||
if ( p.IsOptional ) {
|
||||
newParam.value = p.DefaultValue;
|
||||
}
|
||||
parameters.Add(newParam);
|
||||
}
|
||||
|
||||
if ( method.ReturnType != typeof(void) ) {
|
||||
this.returnValue = new BBObjectParameter(method.ReturnType) { bb = blackboard };
|
||||
} else {
|
||||
this.returnValue = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b1b858ab604d5fc4580ec6c32a01a101
|
||||
timeCreated: 1430481464
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/NodeCanvas/_DeprecatedFiles/Legacy_ExecuteStaticFunction_Multiplatform.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,27 @@
|
||||
using NodeCanvas.Framework;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace NodeCanvas.DialogueTrees
|
||||
{
|
||||
|
||||
[System.Obsolete("Use Jumpers instead")]
|
||||
public class GoToNode : DTNode
|
||||
{
|
||||
|
||||
[SerializeField]
|
||||
private DTNode _targetNode = null;
|
||||
|
||||
public override int maxOutConnections { get { return 0; } }
|
||||
public override bool requireActorSelection { get { return false; } }
|
||||
|
||||
protected override Status OnExecute(Component agent, IBlackboard bb) {
|
||||
if ( _targetNode == null ) {
|
||||
return Error("Target node of GOTO node is null");
|
||||
}
|
||||
|
||||
DLGTree.EnterNode(_targetNode);
|
||||
return Status.Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f28220bd5b490a345b3d075587f00d8f
|
||||
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/_DeprecatedFiles/Legacy_GoToNode.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,74 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace NodeCanvas.BehaviourTrees
|
||||
{
|
||||
|
||||
[System.Obsolete]
|
||||
[Category("Mutators (beta)")]
|
||||
[Name("Node Toggler")]
|
||||
[Description("Enable, Disable or Toggle one or more nodes with provided tag. In practise their incomming connections are disabled\nBeta Feature!")]
|
||||
public class NodeToggler : BTNode
|
||||
{
|
||||
|
||||
public enum ToggleMode
|
||||
{
|
||||
Enable,
|
||||
Disable,
|
||||
Toggle
|
||||
}
|
||||
|
||||
public ToggleMode toggleMode = ToggleMode.Toggle;
|
||||
public string targetNodeTag;
|
||||
|
||||
private List<Node> targetNodes;
|
||||
|
||||
public override void OnGraphStarted() {
|
||||
targetNodes = graph.GetNodesWithTag<Node>(targetNodeTag).ToList();
|
||||
}
|
||||
|
||||
protected override Status OnExecute(Component agent, IBlackboard blackboard) {
|
||||
|
||||
if ( string.IsNullOrEmpty(targetNodeTag) )
|
||||
return Status.Failure;
|
||||
|
||||
if ( targetNodes.Count == 0 ) return Status.Failure;
|
||||
|
||||
if ( toggleMode == ToggleMode.Enable ) {
|
||||
foreach ( var node in targetNodes )
|
||||
node.inConnections[0].isActive = true;
|
||||
}
|
||||
|
||||
if ( toggleMode == ToggleMode.Disable ) {
|
||||
foreach ( var node in targetNodes )
|
||||
node.inConnections[0].isActive = false;
|
||||
}
|
||||
|
||||
if ( toggleMode == ToggleMode.Toggle ) {
|
||||
foreach ( var node in targetNodes )
|
||||
node.inConnections[0].isActive = !node.inConnections[0].isActive;
|
||||
}
|
||||
|
||||
return Status.Success;
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
///---------------------------------------UNITY EDITOR-------------------------------------------
|
||||
#if UNITY_EDITOR
|
||||
|
||||
protected override void OnNodeGUI() {
|
||||
GUILayout.Label(string.Format("{0} '{1}'", toggleMode.ToString(), targetNodeTag));
|
||||
}
|
||||
|
||||
protected override void OnNodeInspectorGUI() {
|
||||
targetNodeTag = EditorUtils.Popup<string>("Node Tag", targetNodeTag, graph.GetAllTagedNodes<Node>().Select(n => n.tag));
|
||||
toggleMode = (ToggleMode)UnityEditor.EditorGUILayout.EnumPopup("Toggle Mode", toggleMode);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: adcd491d0eebe164a9a7f2793378cf8c
|
||||
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/_DeprecatedFiles/Legacy_NodeToggler.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,52 @@
|
||||
using System.Linq;
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace NodeCanvas.BehaviourTrees
|
||||
{
|
||||
|
||||
[System.Obsolete]
|
||||
[Category("Mutators (beta)")]
|
||||
[Name("Root Switcher")]
|
||||
[Description("Switch the root node of the behaviour tree to a new one defined by tag\nBeta Feature!")]
|
||||
public class RootSwitcher : BTNode
|
||||
{
|
||||
|
||||
public string targetNodeTag;
|
||||
|
||||
private Node targetNode;
|
||||
|
||||
public override void OnGraphStarted() {
|
||||
targetNode = graph.GetNodeWithTag<Node>(targetNodeTag);
|
||||
}
|
||||
|
||||
protected override Status OnExecute(Component agent, IBlackboard blackboard) {
|
||||
|
||||
if ( string.IsNullOrEmpty(targetNodeTag) )
|
||||
return Status.Failure;
|
||||
|
||||
if ( targetNode == null ) return Status.Failure;
|
||||
|
||||
if ( graph.primeNode != targetNode )
|
||||
graph.primeNode = targetNode;
|
||||
|
||||
return Status.Success;
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
///---------------------------------------UNITY EDITOR-------------------------------------------
|
||||
#if UNITY_EDITOR
|
||||
|
||||
protected override void OnNodeGUI() {
|
||||
GUILayout.Label("Switch To '" + targetNodeTag + "'");
|
||||
}
|
||||
|
||||
protected override void OnNodeInspectorGUI() {
|
||||
targetNodeTag = EditorUtils.Popup<string>("Node Tag", targetNodeTag, graph.GetAllTagedNodes<Node>().Select(n => n.tag));
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e4bca65541e58aa499b4f639e363a202
|
||||
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/_DeprecatedFiles/Legacy_RootSwitcher.cs
|
||||
uploadId: 704937
|
||||
Reference in New Issue
Block a user