using UnityEngine;

public sealed class Bullet
{
    public readonly BulletBlueprint Blueprint;
    public readonly Vector3 Start;
    public readonly Vector3 End;
    public readonly float LifeTime;
    private float timer;

    public bool IsAlive => timer >= 0;

    public Bullet(BulletBlueprint bullet, float time, Vector3 from, Vector3 to) {
        Blueprint = bullet;
        Start = from;
        End = to;
        LifeTime = time;
        timer = LifeTime;
    }

    public bool ProcessHit(float deltaTime)
    {
        timer -= deltaTime;
        return timer <= 0;
    }
}
