28 lines
562 B
C#
28 lines
562 B
C#
using Godot;
|
|
|
|
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;
|
|
if (player != null)
|
|
LookAt(player.Position);
|
|
}
|
|
|
|
public override async void _PhysicsProcess(double delta)
|
|
{
|
|
_pathFollow.Progress += _speed * (float)delta;
|
|
}
|
|
|
|
public void OnHit(Node node)
|
|
{
|
|
GD.Print("Hit detected");
|
|
QueueFree();
|
|
}
|
|
}
|