﻿#pragma once

#include "DxGame/Rect.h"
#include "DxGame/Vector2.h"

namespace dxgame::shooting
{
    class ImageManager;

    // プレイヤーが発射する1発の弾の位置と実行状態を管理する
    class PlayerShot
    {
    public:
        // 中心をstartPositionへ移動して弾を実行状態にする
        void Spawn(const Vector2& startPosition);

        // 弾を上方向へ移動し画面外へ出たら停止する
        // deltaTimeは1フレームの経過秒数
        void Update(float deltaTime);

        // 実行中の弾を画像で描く
        void Draw(const ImageManager& images) const;

        // 更新、描画の対象ならtrueを返す
        bool IsActive() const;

        // 弾を更新、描画の対象外にする
        void Deactivate();

        // 表示用Rectを現在位置へ移動して返す
        Rect GetDrawRect() const;

    private:
        // 弾の中心座標
        Vector2 position = {};
        bool isActive = false;
    };
}
