29 lines
655 B
C#
29 lines
655 B
C#
using Godot;
|
|
using System;
|
|
|
|
public partial class EnemyMovement : Node
|
|
{
|
|
[Export] private Enemy _enemy;
|
|
[Export] private PathFollow2D _pathFollow2D;
|
|
[Export] private float _speed;
|
|
|
|
private float _finalSpeed => _speed + 0.15f * (float)Math.Log(GameController.Instance.Wave + 1);
|
|
|
|
private double _time = 0;
|
|
|
|
public override void _EnterTree()
|
|
{
|
|
_pathFollow2D.ProgressRatio = 0;
|
|
}
|
|
|
|
public override void _Process(double delta)
|
|
{
|
|
_pathFollow2D.ProgressRatio += (float)delta * (_finalSpeed / 1000f);
|
|
|
|
if (_pathFollow2D.ProgressRatio >= 1.0)
|
|
{
|
|
_enemy.Despawn();
|
|
}
|
|
}
|
|
}
|