diff options
Diffstat (limited to 'Client/Assets/Behavior Designer/Runtime/Basic Tasks/SharedVariables/SharedTransformToGameObject.cs')
-rw-r--r-- | Client/Assets/Behavior Designer/Runtime/Basic Tasks/SharedVariables/SharedTransformToGameObject.cs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SharedVariables/SharedTransformToGameObject.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SharedVariables/SharedTransformToGameObject.cs new file mode 100644 index 00000000..bc8d10ba --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/SharedVariables/SharedTransformToGameObject.cs @@ -0,0 +1,32 @@ +using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.SharedVariables
+{
+ [TaskCategory("Basic/SharedVariable")]
+ [TaskDescription("Gets the GameObject from the Transform component. Returns Success.")]
+ public class SharedTransformToGameObject : Action
+ {
+ [Tooltip("The Transform component")]
+ public SharedTransform sharedTransform;
+ [RequiredField]
+ [Tooltip("The GameObject to set")]
+ public SharedGameObject sharedGameObject;
+
+ public override TaskStatus OnUpdate()
+ {
+ if (sharedTransform.Value == null) {
+ return TaskStatus.Failure;
+ }
+
+ sharedGameObject.Value = sharedTransform.Value.gameObject;
+
+ return TaskStatus.Success;
+ }
+
+ public override void OnReset()
+ {
+ sharedTransform = null;
+ sharedGameObject = null;
+ }
+ }
+}
\ No newline at end of file |