Skip to content
Snippets Groups Projects
Commit ac4bff6a authored by Heine, Eric R's avatar Heine, Eric R
Browse files

Added an implicit operator to get a value from a ScriptableVariable so you...

Added an implicit operator to get a value from a ScriptableVariable so you don't have to type .Value when using its value.
parent e58acc74
No related branches found
No related tags found
1 merge request!8Merge Request for Issue/16 - implicit override
...@@ -21,6 +21,14 @@ namespace Shared.ScriptableVariables { ...@@ -21,6 +21,14 @@ namespace Shared.ScriptableVariables {
public delegate void ValueChangeHandler(); public delegate void ValueChangeHandler();
public event ValueChangeHandler OnValueChanged; public event ValueChangeHandler OnValueChanged;
//---------------------------------------------------------------------------
public static implicit operator T(ScriptableVariable<T> sv) {
if (sv != null) {
return sv.Value;
}
return default;
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
public T Value { public T Value {
get { return value; } get { return value; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment