我正在使用Regex.Split()用户输入并将其转换为列表中的单个单词,但目前它删除了他们添加的任何空格,我希望它保留空白.
string[] newInput = Regex.Split(updatedLine, @"\s+");
Run Code Online (Sandbox Code Playgroud) 当没有障碍物移动或从障碍物的顶部移动到侧面时,我的寻路工作正常,但是当它需要从障碍物的顶部到底部找到它时,它太慢了.
我很确定这是我排序每个循环或循环通过封闭集的方式,但我不知道如何避免这种情况,因为在Windows Phone 7上没有SortedLists
//This Vivid Destination means it doesn't have to find the exact location
//which is helpful as it is continuous environment
Rectangle vividDestination = new Rectangle((int)character.destination.X - 10, (int)character.destination.Y - 10, 20, 20);
while (!vividDestination.Contains(Maths.vectorToPoint(OpenNodes[0].position)))
{
Node Current = OpenNodes[0];
OpenNodes.RemoveAt(0);
ClosedNodes.Add(Current);
Current.calculateNeightbours();
foreach (Node neighbour in Current.neighbours)
{
neighbour.parents = Current.parents + 1;
//The cost of the node is the amount of parent nodes + the distance to destination
neighbour.cost = calculateCost(neighbour.position, character.destination, neighbour.parents);
for (int …Run Code Online (Sandbox Code Playgroud)