rj-action-library/Runtime/Sensors/Sensors.cs

24 lines
486 B
C#

using Godot;
namespace Rokojori
{
public class Sensors
{
public static bool IsActive( RJSensor sensor )
{
return sensor == null ? false : sensor.IsActive();
}
public static float GetValue( RJSensor sensor, float scale = 1 )
{
return sensor == null ? 0 : sensor.GetValue() * scale;
}
public static float PolarAxis( RJSensor negative, RJSensor positive )
{
return GetValue( negative, -1 ) + GetValue( positive, 1 );
}
}
}