import { GdProjectileEffect } from "../../GameData/index.js";
import { Vector2 } from "../../Util/index.js";
import { SimLevel } from "../index.js";

export class SimProjectile {
    private _gdEffect: GdProjectileEffect;
    private _position: Vector2;
    private _targetEnemyIdx: number = -1;
    private _spawnStep: number = -1;
    private _speed: number = -1;
    private _size: number = -1;
    private _dead: boolean = false;

    constructor(level: SimLevel, effect: GdProjectileEffect, position: Vector2, targetEnemyIdx: number, size: number) {
        this._gdEffect = effect;
        this._speed = effect.speed;
        this._position = position;
        this._size = size;
        this._targetEnemyIdx = targetEnemyIdx;
        this._spawnStep = level.currentStep;
    };

    public get gdEffect(): GdProjectileEffect {
        return this._gdEffect;
    }

    public get position(): Vector2 {
        return this._position;
    }

    public set position(value: Vector2) {
        this._position = value;
    }

    public get targetEnemyIdx(): number {
        return this._targetEnemyIdx;
    }

    public get spawnStep(): number {
        return this._spawnStep;
    }

    public get speed(): number {
        return this._speed;
    }

    public get size(): number {
        return this._size;
    }

    public get dead(): boolean {
        return this._dead;
    }

    public set dead(value: boolean) {
        this._dead = value;
    }
}
