From 22891bf59032ba88262824255a706d652031384b Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 10 Mar 2022 14:07:40 +0800 Subject: * move folder --- .../Runtime/Actions/Reflection/SetPropertyValue.cs | 57 ---------------------- 1 file changed, 57 deletions(-) delete mode 100644 Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/SetPropertyValue.cs (limited to 'Assets/ThirdParty/Behavior Designer/Runtime/Actions/Reflection/SetPropertyValue.cs') 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 -- cgit v1.1-26-g67d0