connections
This commit is contained in:
30
Root.cs
Normal file
30
Root.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Godot;
|
||||
using GodotUtilities;
|
||||
|
||||
namespace NodeWar;
|
||||
|
||||
[Scene]
|
||||
public partial class Root : Node2D
|
||||
{
|
||||
[Node]
|
||||
private Line2D line2D;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
GD.Print(line2D);
|
||||
}
|
||||
|
||||
public void ConnectNodules(Nodule a, Nodule b)
|
||||
{
|
||||
GlobalPosition = a.GlobalPosition;
|
||||
line2D.Points = [Vector2.Zero, b.GlobalPosition - a.GlobalPosition];
|
||||
}
|
||||
|
||||
public override void _Notification(int what)
|
||||
{
|
||||
if (what == NotificationSceneInstantiated)
|
||||
{
|
||||
WireNodes();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user