mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-30 21:36:00 +02:00
GetCurFloat conversion
This commit is contained in:
parent
cacfba0d82
commit
a28fe5be7d
1 changed files with 10 additions and 2 deletions
|
@ -707,8 +707,16 @@ namespace Beefy.utils
|
|||
public float GetCurFloat(float theDefault = 0)
|
||||
{
|
||||
Object aVal = GetCurrent();
|
||||
if ((aVal == null) || (!(aVal is float)))
|
||||
return theDefault;
|
||||
if (aVal == null)
|
||||
return theDefault;
|
||||
if (aVal is double)
|
||||
return (float)(double)aVal;
|
||||
if (aVal is int64)
|
||||
return (float)(int64)aVal;
|
||||
if (aVal is int32)
|
||||
return (float)(int32)aVal;
|
||||
if (!(aVal is float))
|
||||
return theDefault;
|
||||
return (float)aVal;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue