using Cirno.Scripts.Actors;
using Godot;

namespace Cirno.Scripts.Resources;

[GlobalClass]
[Tool]
public partial class TimeModifier : Resource
{
    [Export] public float TimeInSeconds = 1f;
    [Export] public TimeModifierType ModifierType;
    [Export] public float Value;
    [Export] public bool Continuous = false;
    public bool Applied { get; set; } = false;

    public ModifierWrapper Wrap()
    {
        return new ModifierWrapper()
        {
            TimeModifier = this,
            Applied = false,
            Elapsed = 0.0,
        };
    }

    public TimeModifier MakeClone()
    {
        return this.MemberwiseClone() as TimeModifier;
    }

    public virtual void Start(Bullet bullet)
    {

    }

    public virtual void Update(Bullet bullet, double delta, double elapsed)
    {
        
    }
}

public class ModifierWrapper
{
    public TimeModifier TimeModifier { get; set; }
    public bool Applied { get; set; } = false;
    public double Elapsed { get; set; } = 0f;

    public virtual void Start()
    {
        
    }

    public virtual void Process(double deltaTime)
    {
        
    }
}

public enum TimeModifierType
{
    SpeedChange,
    RotationChange,
    FacePlayer,
    Dynamic
}
