2024-07-25 05:40:31 +00:00
|
|
|
|
|
|
|
using Godot;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Rokojori
|
|
|
|
{
|
|
|
|
public class Sensors
|
|
|
|
{
|
2025-01-08 18:46:17 +00:00
|
|
|
public static bool IsActive( Sensor sensor )
|
2024-07-25 05:40:31 +00:00
|
|
|
{
|
2025-01-08 18:46:17 +00:00
|
|
|
return sensor == null ? false : sensor.isActive;
|
2024-07-25 05:40:31 +00:00
|
|
|
}
|
|
|
|
|
2025-01-08 18:46:17 +00:00
|
|
|
public static float GetValue( Sensor sensor, float scale = 1 )
|
2024-07-25 05:40:31 +00:00
|
|
|
{
|
2025-01-08 18:46:17 +00:00
|
|
|
return sensor == null ? 0 : sensor.value * scale;
|
2024-07-25 05:40:31 +00:00
|
|
|
}
|
|
|
|
|
2025-01-08 18:46:17 +00:00
|
|
|
public static float PolarAxis( Sensor negative, Sensor positive )
|
2024-07-25 05:40:31 +00:00
|
|
|
{
|
|
|
|
return GetValue( negative, -1 ) + GetValue( positive, 1 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|