using DoomDeathmatch.Component.MVC.Controller;
using Engine.Scene;

namespace DoomDeathmatch.Component.MVC.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);
    _enemyController.GameObject.Scene!.Add(enemyObject);

    return true;
  }
}