Timescalable components

This commit is contained in:
Rendo 2025-07-08 00:05:23 +05:00
commit e527d1da44
11 changed files with 83 additions and 24 deletions

View file

@ -0,0 +1,21 @@
using Godot;
namespace Newlon.Components;
public partial class TimeScalableTimer : Timer
{
[Export] private Entity entity;
private float internal_timescale;
public override void _Ready()
{
internal_timescale = entity.LocalTimescale;
entity.OnLocalTimescaleChanged += OnTimescaleChanged;
}
private void OnTimescaleChanged(float timescale)
{
WaitTime *= internal_timescale / timescale;
internal_timescale = timescale;
}
}