using DoomDeathmatch.Component.MVC.Enemy;
using DoomDeathmatch.Component.MVC.Health;
using Engine.Scene;
using Engine.Util;

namespace DoomDeathmatch.Script.Model.Enemy.Attack;

public class ObjectSpawnAttackBehavior(
  EnemyController parEnemyController,
  HealthController parHealthController,
  float parCooldown,
  Func<EnemyController, HealthController, GameObject> parObjectSpawnFunc
)
  : CooldownAttackBehavior(parEnemyController, parHealthController, parCooldown)
{
  protected override bool CanAttack()
  {
    return true;
  }

  protected override bool ActivateAttack()
  {
    var enemyObject = parObjectSpawnFunc(_enemyController, _healthController);
    EngineUtil.SceneManager.CurrentScene!.Add(enemyObject);

    return true;
  }
}