summaryrefslogtreecommitdiff
path: root/Client/Assets/Behavior Designer/Runtime/Basic Tasks/PlayerPrefs/GetFloat.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Assets/Behavior Designer/Runtime/Basic Tasks/PlayerPrefs/GetFloat.cs')
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/PlayerPrefs/GetFloat.cs31
1 files changed, 31 insertions, 0 deletions
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/PlayerPrefs/GetFloat.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/PlayerPrefs/GetFloat.cs
new file mode 100644
index 00000000..839980b5
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/PlayerPrefs/GetFloat.cs
@@ -0,0 +1,31 @@
+using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityPlayerPrefs
+{
+ [TaskCategory("Basic/PlayerPrefs")]
+ [TaskDescription("Stores the value with the specified key from the PlayerPrefs.")]
+ public class GetFloat : Action
+ {
+ [Tooltip("The key to store")]
+ public SharedString key;
+ [Tooltip("The default value")]
+ public SharedFloat defaultValue;
+ [Tooltip("The value retrieved from the PlayerPrefs")]
+ [RequiredField]
+ public SharedFloat storeResult;
+
+ public override TaskStatus OnUpdate()
+ {
+ storeResult.Value = PlayerPrefs.GetFloat(key.Value, defaultValue.Value);
+
+ return TaskStatus.Success;
+ }
+
+ public override void OnReset()
+ {
+ key = "";
+ defaultValue = 0;
+ storeResult = 0;
+ }
+ }
+} \ No newline at end of file