2025-02-12 16:48:15 +00:00
|
|
|
|
|
|
|
|
using Godot;
|
|
|
|
|
using System.Collections.Generic;
|
2025-10-24 11:38:51 +00:00
|
|
|
using System.Linq;
|
2025-02-12 16:48:15 +00:00
|
|
|
|
|
|
|
|
namespace Rokojori
|
|
|
|
|
{
|
|
|
|
|
[Tool]
|
|
|
|
|
[GlobalClass,Icon("res://addons/rokojori_action_library/Icons/SensorGroup.svg")]
|
|
|
|
|
public partial class MultiSensorDevice: SensorDevice
|
|
|
|
|
{
|
|
|
|
|
[Export]
|
|
|
|
|
public SensorDevice[] devices = new SensorDevice[ 0 ];
|
|
|
|
|
|
2025-10-24 11:38:51 +00:00
|
|
|
public override string GetInfo()
|
|
|
|
|
{
|
|
|
|
|
return GetType().Name + devices.Map( d => d.GetInfo() ).Join( ", " );
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-12 16:48:15 +00:00
|
|
|
[Export]
|
|
|
|
|
public Sensor[] sensors = new Sensor[ 0 ];
|
|
|
|
|
|
|
|
|
|
public override bool ContainsSensor( Sensor sensor )
|
|
|
|
|
{
|
|
|
|
|
for ( int i = 0; i < devices.Length; i++ )
|
|
|
|
|
{
|
|
|
|
|
if ( devices[ i ].ContainsSensor( sensor ) )
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Arrays.Contains( sensors, sensor );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool ContainsIcon( InputIcon icon )
|
|
|
|
|
{
|
|
|
|
|
for ( int i = 0; i < devices.Length; i++ )
|
|
|
|
|
{
|
|
|
|
|
if ( devices[ i ].ContainsIcon( icon ) )
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|