asd
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using Godot;
|
||||
using NodeWar.scripts;
|
||||
|
||||
namespace NodeWar.Scripts;
|
||||
|
||||
@@ -9,7 +10,7 @@ public partial class Pip : Area2D
|
||||
public Faction Faction;
|
||||
|
||||
[Export]
|
||||
public Base Target;
|
||||
public Vector2 Target;
|
||||
|
||||
[Export]
|
||||
public float Speed { get; set; } = 100;
|
||||
@@ -33,16 +34,13 @@ public partial class Pip : Area2D
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (Target == null)
|
||||
return;
|
||||
|
||||
var direction = Target.Position - GlobalPosition;
|
||||
var direction = Target - GlobalPosition;
|
||||
Position += direction.Normalized() * Speed * delta.ToFloat();
|
||||
}
|
||||
|
||||
private void OnAreaEntered(Node2D body)
|
||||
{
|
||||
if (body is Base { Faction: Faction.Computer } enteredBase)
|
||||
if (body is Base enteredBase && enteredBase.Faction != Faction)
|
||||
{
|
||||
enteredBase.HealthComponent.TakeDamage(1);
|
||||
QueueFree();
|
||||
|
||||
Reference in New Issue
Block a user