mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-10 05:05:54 +00:00
Enemy Gravity
This commit is contained in:
parent
b3bfc1a888
commit
d1517f864a
9 changed files with 65 additions and 9 deletions
|
|
@ -11,6 +11,7 @@ public partial class Alert : EnemyStateBase3D
|
|||
[Export] public EnemyStorage3D Storage { get; private set; }
|
||||
[Export] public PlayerDetection3D PlayerDetection { get; private set; }
|
||||
[Export] public NavigationProvider3D NavigationModule { get; private set; }
|
||||
[Export] public GravityProvider GravityProvider { get; private set; }
|
||||
[Export] public bool DebugEnabled { get; set; } = false;
|
||||
|
||||
private bool _isPlayerInRange = false;
|
||||
|
|
@ -79,6 +80,12 @@ public partial class Alert : EnemyStateBase3D
|
|||
|
||||
NavigationModule.Move(Storage.EnemyData.MovementSpeed);
|
||||
|
||||
// Calculate gravity
|
||||
|
||||
MainObject.Velocity = new Vector3(MainObject.Velocity.X, GravityProvider.CalculateGravityVelocity(MainObject.Velocity.Y, delta), MainObject.Velocity.Z);
|
||||
|
||||
MainObject.MoveAndSlide();
|
||||
|
||||
//Storage.FacingDirection = MainObject.Velocity.SnapToCardinal().Normalized();
|
||||
Storage.FacingDirection = MainObject.Velocity.ToVector2().Normalized();
|
||||
Storage.AimingDirection = Storage.FacingDirection;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue