Finished first EA Version #1
@@ -12,10 +12,16 @@ public class MoveNode : ProgramNode
|
|||||||
}
|
}
|
||||||
public override NodeResult Execute(Robot robot, double delta)
|
public override NodeResult Execute(Robot robot, double delta)
|
||||||
{
|
{
|
||||||
pathPoints ??= new List<Vector3>(Pathfinding.GetPath(Pathfinding.GetClosestStartPoint(robot.Position), targetPosition));
|
Vector3I closestPosition = Pathfinding.GetClosestStartPoint(robot.Position);
|
||||||
|
pathPoints ??= new List<Vector3>(Pathfinding.GetPath(closestPosition, targetPosition));
|
||||||
|
|
||||||
if (pathPoints.Count <= 0)
|
if (pathPoints.Count <= 0)
|
||||||
{
|
{
|
||||||
|
if ((closestPosition - targetPosition).Length() == 0)
|
||||||
|
{
|
||||||
|
lastExecutionMessage = "";
|
||||||
|
return NodeResult.SUCCESS;
|
||||||
|
}
|
||||||
lastExecutionMessage = "No path available";
|
lastExecutionMessage = "No path available";
|
||||||
return NodeResult.FAILURE;
|
return NodeResult.FAILURE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,6 +112,14 @@ public partial class Robot : Node3D
|
|||||||
|
|
||||||
currentMessage = "No script executing";
|
currentMessage = "No script executing";
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CoolDown(
|
||||||
|
delta,
|
||||||
|
GameData.robotStats.GetCoolingRate(IdleHeatLossPerSecond)
|
||||||
|
* TypeStats.CoolingMultiplier
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Visible = Math.Round(Math.Abs(Position.Y / GameData.tileHeight), 0) == GameData.visibleLayer;
|
Visible = Math.Round(Math.Abs(Position.Y / GameData.tileHeight), 0) == GameData.visibleLayer;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user