Enemy Gravity

This commit is contained in:
Marco 2025-06-29 18:09:13 +02:00
commit d1517f864a
9 changed files with 65 additions and 9 deletions

View file

@ -10,6 +10,8 @@ public partial class Idle : EnemyStateBase3D
[Export] public EnemyStorage3D Storage { get; private set; }
[Export] public PlayerDetection3D PlayerDetection { get; private set; }
[Export] public GravityProvider GravityProvider { get; private set; }
[Export] public bool DebugEnabled { get; set; } = false;
private bool _isPlayerInRange = false;
@ -84,6 +86,10 @@ public partial class Idle : EnemyStateBase3D
DebugDraw3D.DrawText(MainObject.GlobalPosition - new Vector3(0,16,0), "Idle");
}
MainObject.Velocity = new Vector3(MainObject.Velocity.X, GravityProvider.CalculateGravityVelocity(MainObject.Velocity.Y, delta), MainObject.Velocity.Z);
MainObject.MoveAndSlide();
}
public override void ProcessState(double delta)