53 lines
962 B
C#
53 lines
962 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Text.RegularExpressions;
|
|
using System.Text;
|
|
using Godot;
|
|
|
|
namespace Rokojori
|
|
{
|
|
[Tool]
|
|
[GlobalClass]
|
|
public partial class FloatDriver:Node
|
|
{
|
|
float _driverValue = 0f;
|
|
|
|
[Export( PropertyHint.Range, "0,1" )]
|
|
public float value
|
|
{
|
|
get => _driverValue;
|
|
set
|
|
{
|
|
_driverValue = value;
|
|
UpdateValue();
|
|
}
|
|
}
|
|
|
|
[ExportToolButton( "Update Value")]
|
|
public Callable updateValueButton => Callable.From( ()=> UpdateValue() ) ;
|
|
|
|
void UpdateValue()
|
|
{
|
|
if ( targets == null )
|
|
{
|
|
return;
|
|
}
|
|
|
|
for ( int i = 0; i < targets.Length; i++ )
|
|
{
|
|
if ( targets[ i ] == null || targets[ i ].GetGodotObject( this ) == null )
|
|
{
|
|
continue;
|
|
}
|
|
|
|
targets[ i ].Update( this );
|
|
}
|
|
}
|
|
|
|
[Export]
|
|
public FloatDriverTarget[] targets = [];
|
|
|
|
|
|
|
|
}
|
|
} |