38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using Godot;
|
|
|
|
public class MoveNode : ProgramNode
|
|
{
|
|
public Vector3 startPosition;
|
|
public Vector3I targetPosition;
|
|
public MoveNode()
|
|
{
|
|
DisplayText = "Move";
|
|
}
|
|
public override bool Execute(Robot robot)
|
|
{
|
|
startPosition = robot.Position;
|
|
GD.Print(targetPosition);
|
|
robot.Position = GameData.map[targetPosition.Y].tiles[targetPosition.X, targetPosition.Z].Position;
|
|
if (nextNode != null)
|
|
{
|
|
return nextNode.Execute(robot);
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public override void ReadParameters(NodeDisplay display)
|
|
{
|
|
HBoxContainer valueContainer = display.GetNode<HBoxContainer>("./EditorDisplay/HBoxContainer/");
|
|
|
|
GD.Print(valueContainer.GetNode<SpinBox>("./CoordinateX").Value);
|
|
int posX = (int)valueContainer.GetNode<SpinBox>("./CoordinateX").Value;
|
|
int posY = (int)valueContainer.GetNode<SpinBox>("./CoordinateY").Value;
|
|
int posZ = (int)valueContainer.GetNode<SpinBox>("./CoordinateZ").Value;
|
|
targetPosition = new Vector3I(posX, posY, posZ);
|
|
}
|
|
|
|
|
|
} |