This commit is contained in:
2025-01-06 22:36:52 +03:00
parent 0629544314
commit d3b899ba93
103 changed files with 1352 additions and 452 deletions

View File

@@ -0,0 +1,27 @@
using DoomDeathmatch.Component.MVC.Enemy;
using DoomDeathmatch.Component.MVC.Health;
namespace DoomDeathmatch.Script.Model.Enemy.Attack;
public class CloseContinuousAttackBehavior(
EnemyController parEnemyController,
HealthController parHealthController,
float parRadius,
float parDamage)
: AttackBehavior(parEnemyController, parHealthController)
{
public override bool Attack(double parDeltaTime)
{
var distanceSquared =
(_enemyController.GameObject.Transform.Translation - _healthController.GameObject.Transform.Translation)
.LengthSquared;
if (distanceSquared <= parRadius * parRadius)
{
_healthController.TakeDamage(parDamage * (float)parDeltaTime);
return true;
}
return false;
}
}