30 lines
461 B
C#
30 lines
461 B
C#
using Godot;
|
|
using System;
|
|
|
|
namespace BITFactory;
|
|
public partial class AutoFollowPath : PathFollow3D
|
|
{
|
|
[Export] private float speed;
|
|
[Export] private bool useRatio;
|
|
private float _progress;
|
|
public override void _Ready()
|
|
{
|
|
base._Ready();
|
|
_progress = Progress;
|
|
}
|
|
|
|
public override void _Process(double delta)
|
|
{
|
|
_progress += speed * (float)delta;
|
|
if (useRatio)
|
|
{
|
|
ProgressRatio = _progress%1;
|
|
}
|
|
else
|
|
{ Progress = _progress;
|
|
|
|
}
|
|
|
|
}
|
|
}
|