summaryrefslogtreecommitdiff
path: root/Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/GetPropertyValue.cs
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/GetPropertyValue.cs
parent8b04ea73e540067f83870b61d89db4868fea5e8a (diff)
* move folder
Diffstat (limited to 'Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/GetPropertyValue.cs')
-rw-r--r--Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/GetPropertyValue.cs58
1 files changed, 0 insertions, 58 deletions
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