diff options
Diffstat (limited to 'Client/Assets/Behavior Designer/Runtime/Basic Tasks/PlayerPrefs/GetInt.cs')
-rw-r--r-- | Client/Assets/Behavior Designer/Runtime/Basic Tasks/PlayerPrefs/GetInt.cs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/PlayerPrefs/GetInt.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/PlayerPrefs/GetInt.cs new file mode 100644 index 00000000..3dca7702 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/PlayerPrefs/GetInt.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 GetInt : Action
+ {
+ [Tooltip("The key to store")]
+ public SharedString key;
+ [Tooltip("The default value")]
+ public SharedInt defaultValue;
+ [Tooltip("The value retrieved from the PlayerPrefs")]
+ [RequiredField]
+ public SharedInt storeResult;
+
+ public override TaskStatus OnUpdate()
+ {
+ storeResult.Value = PlayerPrefs.GetInt(key.Value, defaultValue.Value);
+
+ return TaskStatus.Success;
+ }
+
+ public override void OnReset()
+ {
+ key = "";
+ defaultValue = 0;
+ storeResult = 0;
+ }
+ }
+}
\ No newline at end of file |