using System;
using Fort23.Core;
using GameLogic.Combat.CombatTool;
using UnityEngine;
using Utility;

namespace GameLogic.Combat
{
    public class CombatDrive :  Singleton<CombatDrive>
    {
        public CombatController CombatController;

        public async CTask AddCombatController(CombatController combatController)
        {
            this.CombatController = combatController;
            await CombatController.InitCombat();
            StaticUpdater.Instance.AddRenderUpdateCallBack(Update);
        }

        public void Update()
        {
            CombatController.Update(Time.deltaTime);
        }

        public void Dispose()
        {
            StaticUpdater.Instance.RemoveRenderUpdateCallBack(Update);
        }
    }
}