using Godot;

namespace Newlon.Components.Zombies;

public partial class ZombieMover : Node
{
    [Export]
    private FloatModifiers _speed;
    [Export]
    private float _speedControlMult;
    private Node2D _zombie;

    public override void _Ready()
    {
        _zombie = GetParent<Node2D>();
    }

    public override void _PhysicsProcess(double delta)
    {
        _zombie.Position -= _zombie.Transform.X
                                * (float)delta
                                * Utility.TileWidth
                                * GetParent<RuntimeZombieData>().LocalTimescale
                                * _speed.GetValue()
                                * _speedControlMult;
    }

    public void SetSpeedFlat(float speed)
    {
        _speed.SetFlat(speed);
    }
    public void SetSpeedPercentage(float speed)
    {
        _speed.SetPercentage(speed);
    }
    public void SetSpeedMult(float speed)
    {
        _speed.SetMult(speed);
    }
    public void AddMult(float amount)
    {
        _speed.ChangeMult(amount);
    }
}
