diff options
Diffstat (limited to 'Client/Assets/Behavior Designer/Runtime/Basic Tasks/SharedVariables/SetSharedTransform.cs')
-rw-r--r-- | Client/Assets/Behavior Designer/Runtime/Basic Tasks/SharedVariables/SetSharedTransform.cs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SharedVariables/SetSharedTransform.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SharedVariables/SetSharedTransform.cs new file mode 100644 index 00000000..e1f46c80 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SharedVariables/SetSharedTransform.cs @@ -0,0 +1,28 @@ +using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.SharedVariables
+{
+ [TaskCategory("Basic/SharedVariable")]
+ [TaskDescription("Sets the SharedTransform variable to the specified object. Returns Success.")]
+ public class SetSharedTransform : Action
+ {
+ [Tooltip("The value to set the SharedTransform to. If null the variable will be set to the current Transform")]
+ public SharedTransform targetValue;
+ [RequiredField]
+ [Tooltip("The SharedTransform to set")]
+ public SharedTransform targetVariable;
+
+ public override TaskStatus OnUpdate()
+ {
+ targetVariable.Value = (targetValue.Value != null ? targetValue.Value : transform);
+
+ return TaskStatus.Success;
+ }
+
+ public override void OnReset()
+ {
+ targetValue = null;
+ targetVariable = null;
+ }
+ }
+}
\ No newline at end of file |