mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-11 23:45:54 +00:00
Enemy Gravity
This commit is contained in:
parent
b3bfc1a888
commit
d1517f864a
9 changed files with 65 additions and 9 deletions
|
|
@ -16,6 +16,8 @@ public partial class Shooting : EnemyStateBase3D
|
|||
[Export] public Weapon3D EquippedWeapon;
|
||||
[Export] public NavigationProvider3D NavigationModule { get; private set; }
|
||||
|
||||
[Export] public GravityProvider GravityProvider { get; private set; }
|
||||
|
||||
private bool _isPlayerInRange = false;
|
||||
private Vector3? _currentStrafeTarget = null;
|
||||
private float _strafeSpeed => Storage.EnemyData.StrafeSpeed;
|
||||
|
|
@ -99,6 +101,11 @@ public partial class Shooting : EnemyStateBase3D
|
|||
NavigationModule.SetTarget(_currentStrafeTarget.Value);
|
||||
NavigationModule.Move(_strafeSpeed);
|
||||
}
|
||||
|
||||
// Calculate gravity
|
||||
MainObject.Velocity = new Vector3(MainObject.Velocity.X, GravityProvider.CalculateGravityVelocity(MainObject.Velocity.Y, delta), MainObject.Velocity.Z);
|
||||
|
||||
MainObject.MoveAndSlide();
|
||||
}
|
||||
|
||||
private Vector3? CalculateStrafePosition()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue