summaryrefslogtreecommitdiff
path: root/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2022-03-10 14:07:40 +0800
committerchai <chaifix@163.com>2022-03-10 14:07:40 +0800
commit22891bf59032ba88262824255a706d652031384b (patch)
tree7595439ba9966c9402d37e37cee5e8cf098757d5 /Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection
parent8b04ea73e540067f83870b61d89db4868fea5e8a (diff)
* move folder
Diffstat (limited to 'Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection')
-rw-r--r--Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/GetFieldValue.cs58
-rw-r--r--Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/GetFieldValue.cs.meta8
-rw-r--r--Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/GetPropertyValue.cs58
-rw-r--r--Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/GetPropertyValue.cs.meta8
-rw-r--r--Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/InvokeMethod.cs86
-rw-r--r--Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/InvokeMethod.cs.meta8
-rw-r--r--Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/SetFieldValue.cs57
-rw-r--r--Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/SetFieldValue.cs.meta8
-rw-r--r--Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/SetPropertyValue.cs57
-rw-r--r--Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/SetPropertyValue.cs.meta8
10 files changed, 0 insertions, 356 deletions
diff --git a/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/GetFieldValue.cs b/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/GetFieldValue.cs
deleted file mode 100644
index a5b31bc4..00000000
--- a/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/GetFieldValue.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using UnityEngine;
-using System;
-using System.Reflection;
-
-namespace BehaviorDesigner.Runtime.Tasks
-{
- [TaskDescription("Gets the value from the field specified. Returns success if the field was retrieved.")]
- [HelpURL("http://www.opsive.com/assets/BehaviorDesigner/documentation.php?id=147")]
- [TaskCategory("Reflection")]
- [TaskIcon("{SkinColor}ReflectionIcon.png")]
- public class GetFieldValue : Action
- {
- [Tooltip("The GameObject to get the field on")]
- public SharedGameObject targetGameObject;
- [Tooltip("The component to get the field on")]
- public SharedString componentName;
- [Tooltip("The name of the field")]
- public SharedString fieldName;
- [Tooltip("The value of the field")]
- [RequiredField]
- public SharedVariable fieldValue;
-
- public override TaskStatus OnUpdate()
- {
- if (fieldValue == null) {
- Debug.LogWarning("Unable to get field - field value is null");
- return TaskStatus.Failure;
- }
-
- var type = TaskUtility.GetTypeWithinAssembly(componentName.Value);
- if (type == null) {
- Debug.LogWarning("Unable to get field - type is null");
- return TaskStatus.Failure;
- }
-
- var component = GetDefaultGameObject(targetGameObject.Value).GetComponent(type);
- if (component == null) {
- Debug.LogWarning("Unable to get the field with component " + componentName.Value);
- return TaskStatus.Failure;
- }
-
- // If you are receiving a compiler error on the Windows Store platform see this topic:
- // http://www.opsive.com/assets/BehaviorDesigner/documentation.php?id=46
- var field = component.GetType().GetField(fieldName.Value);
- fieldValue.SetValue(field.GetValue(component));
-
- return TaskStatus.Success;
- }
-
- public override void OnReset()
- {
- targetGameObject = null;
- componentName = null;
- fieldName = null;
- fieldValue = null;
- }
- }
-} \ No newline at end of file
diff --git a/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/GetFieldValue.cs.meta b/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/GetFieldValue.cs.meta
deleted file mode 100644
index 34bf75c3..00000000
--- a/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/GetFieldValue.cs.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: bc317dd7feb2085499edb0d0c4604640
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
diff --git a/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/GetPropertyValue.cs b/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/GetPropertyValue.cs
deleted file mode 100644
index be81eee4..00000000
--- a/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/GetPropertyValue.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using UnityEngine;
-using System;
-using System.Reflection;
-
-namespace BehaviorDesigner.Runtime.Tasks
-{
- [TaskDescription("Gets the value from the property specified. Returns success if the property was retrieved.")]
- [HelpURL("http://www.opsive.com/assets/BehaviorDesigner/documentation.php?id=148")]
- [TaskCategory("Reflection")]
- [TaskIcon("{SkinColor}ReflectionIcon.png")]
- public class GetPropertyValue : Action
- {
- [Tooltip("The GameObject to get the property of")]
- public SharedGameObject targetGameObject;
- [Tooltip("The component to get the property of")]
- public SharedString componentName;
- [Tooltip("The name of the property")]
- public SharedString propertyName;
- [Tooltip("The value of the property")]
- [RequiredField]
- public SharedVariable propertyValue;
-
- public override TaskStatus OnUpdate()
- {
- if (propertyValue == null) {
- Debug.LogWarning("Unable to get property - property value is null");
- return TaskStatus.Failure;
- }
-
- var type = TaskUtility.GetTypeWithinAssembly(componentName.Value);
- if (type == null) {
- Debug.LogWarning("Unable to get property - type is null");
- return TaskStatus.Failure;
- }
-
- var component = GetDefaultGameObject(targetGameObject.Value).GetComponent(type);
- if (component == null) {
- Debug.LogWarning("Unable to get the property with component " + componentName.Value);
- return TaskStatus.Failure;
- }
-
- // If you are receiving a compiler error on the Windows Store platform see this topic:
- // http://www.opsive.com/assets/BehaviorDesigner/documentation.php?id=46
- var property = component.GetType().GetProperty(propertyName.Value);
- propertyValue.SetValue(property.GetValue(component, null));
-
- return TaskStatus.Success;
- }
-
- public override void OnReset()
- {
- targetGameObject = null;
- componentName = null;
- propertyName = null;
- propertyValue = null;
- }
- }
-} \ No newline at end of file
diff --git a/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/GetPropertyValue.cs.meta b/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/GetPropertyValue.cs.meta
deleted file mode 100644
index 587385b3..00000000
--- a/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/GetPropertyValue.cs.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: dda9c9b7c6ff2ee4f95a2e208cddae64
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
diff --git a/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/InvokeMethod.cs b/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/InvokeMethod.cs
deleted file mode 100644
index 7c239dbd..00000000
--- a/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/InvokeMethod.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-using UnityEngine;
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-
-namespace BehaviorDesigner.Runtime.Tasks
-{
- [TaskDescription("Invokes the specified method with the specified parameters. Can optionally store the return value. Returns success if the method was invoked.")]
- [HelpURL("http://www.opsive.com/assets/BehaviorDesigner/documentation.php?id=145")]
- [TaskCategory("Reflection")]
- [TaskIcon("{SkinColor}ReflectionIcon.png")]
- public class InvokeMethod : Action
- {
- [Tooltip("The GameObject to invoke the method on")]
- public SharedGameObject targetGameObject;
- [Tooltip("The component to invoke the method on")]
- public SharedString componentName;
- [Tooltip("The name of the method")]
- public SharedString methodName;
- [Tooltip("The first parameter of the method")]
- public SharedVariable parameter1;
- [Tooltip("The second parameter of the method")]
- public SharedVariable parameter2;
- [Tooltip("The third parameter of the method")]
- public SharedVariable parameter3;
- [Tooltip("The fourth parameter of the method")]
- public SharedVariable parameter4;
- [Tooltip("Store the result of the invoke call")]
- public SharedVariable storeResult;
-
- public override TaskStatus OnUpdate()
- {
- var type = TaskUtility.GetTypeWithinAssembly(componentName.Value);
- if (type == null) {
- Debug.LogWarning("Unable to invoke - type is null");
- return TaskStatus.Failure;
- }
-
- var component = GetDefaultGameObject(targetGameObject.Value).GetComponent(type);
- if (component == null) {
- Debug.LogWarning("Unable to invoke method with component " + componentName.Value);
- return TaskStatus.Failure;
- }
-
- var parameterList = new List<object>();
- var parameterTypeList = new List<Type>();
- SharedVariable sharedVariable = null;
- for (int i = 0; i < 4; ++i) {
- var parameterField = GetType().GetField("parameter" + (i + 1));
- if ((sharedVariable = parameterField.GetValue(this) as SharedVariable) != null) {
- parameterList.Add(sharedVariable.GetValue());
- parameterTypeList.Add(sharedVariable.GetType().GetProperty("Value").PropertyType);
- } else {
- break;
- }
- }
- // If you are receiving a compiler error on the Windows Store platform see this topic:
- // http://www.opsive.com/assets/BehaviorDesigner/documentation.php?id=46
- var methodInfo = component.GetType().GetMethod(methodName.Value, parameterTypeList.ToArray());
-
- if (methodInfo == null) {
- Debug.LogWarning("Unable to invoke method " + methodName.Value + " on component " + componentName.Value);
- return TaskStatus.Failure;
- }
-
- var result = methodInfo.Invoke(component, parameterList.ToArray());
- if (storeResult != null) {
- storeResult.SetValue(result);
- }
-
- return TaskStatus.Success;
- }
-
- public override void OnReset()
- {
- targetGameObject = null;
- componentName = null;
- methodName = null;
- parameter1 = null;
- parameter2 = null;
- parameter3 = null;
- parameter4 = null;
- storeResult = null;
- }
- }
-} \ No newline at end of file
diff --git a/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/InvokeMethod.cs.meta b/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/InvokeMethod.cs.meta
deleted file mode 100644
index eed4a86a..00000000
--- a/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/InvokeMethod.cs.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 359bd67578f53034ab2eb00e7696d317
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
diff --git a/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/SetFieldValue.cs b/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/SetFieldValue.cs
deleted file mode 100644
index 79675c97..00000000
--- a/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/SetFieldValue.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-using UnityEngine;
-using System;
-using System.Reflection;
-
-namespace BehaviorDesigner.Runtime.Tasks
-{
- [TaskDescription("Sets the field to the value specified. Returns success if the field was set.")]
- [HelpURL("http://www.opsive.com/assets/BehaviorDesigner/documentation.php?id=149")]
- [TaskCategory("Reflection")]
- [TaskIcon("{SkinColor}ReflectionIcon.png")]
- public class SetFieldValue : Action
- {
- [Tooltip("The GameObject to set the field on")]
- public SharedGameObject targetGameObject;
- [Tooltip("The component to set the field on")]
- public SharedString componentName;
- [Tooltip("The name of the field")]
- public SharedString fieldName;
- [Tooltip("The value to set")]
- public SharedVariable fieldValue;
-
- public override TaskStatus OnUpdate()
- {
- if (fieldValue == null) {
- Debug.LogWarning("Unable to get field - field value is null");
- return TaskStatus.Failure;
- }
-
- var type = TaskUtility.GetTypeWithinAssembly(componentName.Value);
- if (type == null) {
- Debug.LogWarning("Unable to set field - type is null");
- return TaskStatus.Failure;
- }
-
- var component = GetDefaultGameObject(targetGameObject.Value).GetComponent(type);
- if (component == null) {
- Debug.LogWarning("Unable to set the field with component " + componentName.Value);
- return TaskStatus.Failure;
- }
-
- // If you are receiving a compiler error on the Windows Store platform see this topic:
- // http://www.opsive.com/assets/BehaviorDesigner/documentation.php?id=46
- var field = component.GetType().GetField(fieldName.Value);
- field.SetValue(component, fieldValue.GetValue());
-
- return TaskStatus.Success;
- }
-
- public override void OnReset()
- {
- targetGameObject = null;
- componentName = null;
- fieldName = null;
- fieldValue = null;
- }
- }
-} \ No newline at end of file
diff --git a/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/SetFieldValue.cs.meta b/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/SetFieldValue.cs.meta
deleted file mode 100644
index 433a991c..00000000
--- a/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/SetFieldValue.cs.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 21e389787213ba24ab1a6817def634ae
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
diff --git a/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/SetPropertyValue.cs b/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/SetPropertyValue.cs
deleted file mode 100644
index 9ec7cd08..00000000
--- a/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/SetPropertyValue.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-using UnityEngine;
-using System;
-using System.Reflection;
-
-namespace BehaviorDesigner.Runtime.Tasks
-{
- [TaskDescription("Sets the property to the value specified. Returns success if the property was set.")]
- [HelpURL("http://www.opsive.com/assets/BehaviorDesigner/documentation.php?id=150")]
- [TaskCategory("Reflection")]
- [TaskIcon("{SkinColor}ReflectionIcon.png")]
- public class SetPropertyValue : Action
- {
- [Tooltip("The GameObject to set the property on")]
- public SharedGameObject targetGameObject;
- [Tooltip("The component to set the property on")]
- public SharedString componentName;
- [Tooltip("The name of the property")]
- public SharedString propertyName;
- [Tooltip("The value to set")]
- public SharedVariable propertyValue;
-
- public override TaskStatus OnUpdate()
- {
- if (propertyValue == null) {
- Debug.LogWarning("Unable to get field - field value is null");
- return TaskStatus.Failure;
- }
-
- var type = TaskUtility.GetTypeWithinAssembly(componentName.Value);
- if (type == null) {
- Debug.LogWarning("Unable to set property - type is null");
- return TaskStatus.Failure;
- }
-
- var component = GetDefaultGameObject(targetGameObject.Value).GetComponent(type);
- if (component == null) {
- Debug.LogWarning("Unable to set the property with component " + componentName.Value);
- return TaskStatus.Failure;
- }
-
- // If you are receiving a compiler error on the Windows Store platform see this topic:
- // http://www.opsive.com/assets/BehaviorDesigner/documentation.php?id=46
- var property = component.GetType().GetProperty(propertyName.Value);
- property.SetValue(component, propertyValue.GetValue(), null);
-
- return TaskStatus.Success;
- }
-
- public override void OnReset()
- {
- targetGameObject = null;
- componentName = null;
- propertyName = null;
- propertyValue = null;
- }
- }
-} \ No newline at end of file
diff --git a/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/SetPropertyValue.cs.meta b/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/SetPropertyValue.cs.meta
deleted file mode 100644
index 012823b6..00000000
--- a/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/SetPropertyValue.cs.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: d98b13b7ae4b36b4092b439731466d9b
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData: