private void PollInput() { Vector2?prevStart = debugStart; Vector2?prevEnd = debugEnd; if (Input.GetKey(KeyCode.LeftAlt)) { if (Input.GetKeyDown(KeyCode.Mouse0)) { debugStart = Utility.MousePositionInWorld; } if (Input.GetKeyDown(KeyCode.Mouse1)) { debugEnd = Utility.MousePositionInWorld; } } if ((prevStart != debugStart || prevEnd != debugEnd) && (debugStart.HasValue && debugEnd.HasValue)) { AStarPathfinding.GetRawPath(debugStart.Value, debugEnd.Value, true); debugStart = null; debugEnd = null; } }
public AStarPath(Vector2 start, Vector2 end) { TargetPosition = end; this.rawPath = AStarPathfinding.GetRawPath(start, end); }