Various enemy debugging stuff
This commit is contained in:
@@ -31,7 +31,7 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
|
||||
[Export] protected EnemyStatResource _enemyStatResource { get; set; } = default!;
|
||||
|
||||
[Export]
|
||||
protected float _movementSpeed = 2f;
|
||||
protected float _movementSpeed = 0.5f;
|
||||
#endregion
|
||||
|
||||
#region Node Dependencies
|
||||
@@ -48,11 +48,13 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
|
||||
|
||||
public AutoProp<double> CurrentHP { get; set; }
|
||||
|
||||
public string EnemyName;
|
||||
|
||||
private float _knockbackStrength = 0.0f;
|
||||
|
||||
private Vector3 _knockbackDirection = Vector3.Zero;
|
||||
|
||||
private IDamageCalculator _damageCalculator;
|
||||
private DamageCalculator _damageCalculator;
|
||||
|
||||
#region Godot methods
|
||||
public void Setup()
|
||||
@@ -98,7 +100,7 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
|
||||
|
||||
_enemyModelView.SetCurrentDirection(GlobalBasis, -_player.CurrentBasis.Z);
|
||||
|
||||
if (_enemyModelView is EnemyModelView2D enemyModelView2D)
|
||||
if (_enemyModelView is EnemyModelView2D)
|
||||
{
|
||||
if (_enemyLogic.Value is EnemyLogic.State.Patrolling or EnemyLogic.State.FollowPlayer)
|
||||
_enemyModelView.PlayWalkAnimation();
|
||||
@@ -119,8 +121,8 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
|
||||
|
||||
public virtual void Move(Vector3 velocity)
|
||||
{
|
||||
_knockbackStrength = _knockbackStrength * 0.9f;
|
||||
Velocity = velocity + (_knockbackDirection * _knockbackStrength);
|
||||
_knockbackStrength *= 0.9f;
|
||||
Velocity = velocity * _movementSpeed + (_knockbackDirection * _knockbackStrength);
|
||||
MoveAndSlide();
|
||||
}
|
||||
|
||||
@@ -162,6 +164,7 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
|
||||
public virtual void Die()
|
||||
{
|
||||
SetProcess(false);
|
||||
_movementSpeed = 0;
|
||||
CurrentHP.OnNext(0);
|
||||
_enemyLogic.Input(new EnemyLogic.Input.EnemyDefeated());
|
||||
_collisionShape.SetDeferred("disabled", true);
|
||||
|
||||
Reference in New Issue
Block a user