added enemy inputs as a resource
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 18s
Create tag and build when new code gets to main / Export (push) Successful in 9m48s

This commit is contained in:
2026-01-16 11:18:57 +01:00
parent 9e75193731
commit fd3eb35782
4 changed files with 44 additions and 6 deletions

View File

@@ -7,8 +7,8 @@ public partial class FirstEnemy : CharacterBody3D
[Export]
public Node3D Target { get; set; }
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
public float Speed = 5.0f;
[Export]
public EnemyInitInputs Inputs;
private RayCast3D _wallInFrontRayCast;
@@ -26,11 +26,11 @@ public partial class FirstEnemy : CharacterBody3D
LookAt(targetPlane);
var velocity = Velocity;
velocity.X = direction.X * Speed;
velocity.Z = direction.Z * Speed;
velocity.X = direction.X * Inputs.Speed;
velocity.Z = direction.Z * Inputs.Speed;
if (_wallInFrontRayCast.IsColliding())
velocity.Y = Speed;
velocity.Y = Inputs.Speed;
else if (!IsOnFloor())
velocity += GetGravity() * (float)delta;