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

26 lines
451 B
C#
Raw Normal View History

2024-07-25 05:40:31 +00:00
using Godot;
namespace Rokojori
{
2024-11-13 11:57:10 +00:00
[GlobalClass,Icon("res://addons/rokojori_action_library/Icons/RJSensor.svg")]
2025-01-08 18:46:17 +00:00
public partial class CombineSensor : Sensor
2024-07-25 05:40:31 +00:00
{
[Export]
2025-01-08 18:46:17 +00:00
public Sensor[] sensors;
2024-07-25 05:40:31 +00:00
2025-01-08 18:46:17 +00:00
protected override void UpdateValue()
2024-07-25 05:40:31 +00:00
{
var value = 0f;
for ( int i = 0; i < sensors.Length; i++ )
{
2025-01-08 18:46:17 +00:00
value = Mathf.Max( value, sensors[ i ].value );
2024-07-25 05:40:31 +00:00
}
2025-01-08 18:46:17 +00:00
SetFloatValue( value );
2024-07-25 05:40:31 +00:00
}
}
}