﻿#pragma once

#include "DxGame/Rect.h"
#include "DxGame/Vector2.h"

namespace dxgame::shooting
{
    class ImageManager;

    // 敵一体の位置、移動、表示、実行状態を管理する
    class Enemy
    {
    public:
        // 下方向へ直進するか左右へ波打ちながら進むかを表す
        enum class Behaviour
        {
            Straight,
            Wave
        };

        // 中心座標、速度、移動方法を設定して敵を出現させる
        void Spawn(const Vector2& startPosition, float speed, Behaviour spawnBehaviour);

        // 敵を移動させ、画面の下へ出たら停止する
        void Update(float deltaTime);

        // 実行中の敵を画像で描く
        void Draw(const ImageManager& images) const;

        // 更新と描画の対象ならtrueを返す
        bool IsActive() const;

        // 敵を更新と描画の対象外にする
        void Deactivate();

        // 表示用Rectを現在位置へ移動して返す
        Rect GetDrawRect() const;

    private:
        Vector2 position = {};
        float baseX = 0.0f;
        float moveSpeed = 0.0f;
        float age = 0.0f;
        Behaviour behaviour = Behaviour::Straight;
        bool isActive = false;
    };
}
