Beeg checkin

This commit is contained in:
2023-09-06 03:49:16 -07:00
parent f180d4cacd
commit f8cca640a6
320 changed files with 2751 additions and 26682 deletions

View File

@@ -0,0 +1,20 @@
using Godot;
using System.Linq;
public partial class MeleeEnemy : BasicEnemy
{
[Export]
private float _speed = 0.4f;
public override void _PhysicsProcess(double delta)
{
var players = GetTree().GetNodesInGroup("Player");
if (players.Any())
{
var convertedPlayers = players.Select(x => (Node3D)x);
var target = convertedPlayers.OrderBy(x => Position.DistanceTo(x.Position)).FirstOrDefault();
Position = Position.MoveToward(target.Position, _speed * (float)delta);
LookAt(-target.Position, Vector3.Up);
}
}
}