Basic enemy pathing implementation
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
using Godot;
|
||||
|
||||
public partial class TestEnemy : Node3D
|
||||
public partial class TestEnemy : RigidBody3D
|
||||
{
|
||||
[Export]
|
||||
private float _speed;
|
||||
[Export]
|
||||
private PathFollow3D _pathFollow;
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
var player = GetTree().GetFirstNodeInGroup("Player") as TestCharacter;
|
||||
@@ -9,6 +14,11 @@ public partial class TestEnemy : Node3D
|
||||
LookAt(player.Position);
|
||||
}
|
||||
|
||||
public override async void _PhysicsProcess(double delta)
|
||||
{
|
||||
_pathFollow.Progress += _speed * (float)delta;
|
||||
}
|
||||
|
||||
public void OnHit(Node node)
|
||||
{
|
||||
GD.Print("Hit detected");
|
||||
|
||||
Reference in New Issue
Block a user