rokojori_action_library/Runtime/Animation/Driver/FloatDriverTarget.cs

28 lines
730 B
C#
Raw Normal View History

2026-01-05 21:14:39 +00:00
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
using Godot;
namespace Rokojori
{
[Tool]
[GlobalClass]
public abstract partial class FloatDriverTarget:Resource
{
[Export]
public Curve mappingCurve;
2026-01-10 18:35:50 +00:00
public abstract string GetTargetMemberPath( IFloatDriver driver );
2026-01-05 21:14:39 +00:00
2026-01-10 18:35:50 +00:00
public abstract GodotObject GetGodotObject( IFloatDriver driver );
2026-01-05 21:14:39 +00:00
2026-01-10 18:35:50 +00:00
public void Update( IFloatDriver driver )
2026-01-05 21:14:39 +00:00
{
2026-01-10 18:35:50 +00:00
var mappedValue = mappingCurve.Sample( driver.GetDriverFloatValue() );
2026-01-05 21:14:39 +00:00
var targetMemberPath = GetTargetMemberPath( driver );
TweenFloat.SetTargetValue( GetGodotObject( driver ), targetMemberPath, mappedValue );
}
}
}