Mehrere Änderungen an Wegfindungsbehandlung:

- Wegfindung wird nicht mehr ausgelöst, wenn auf Feld geklickt wird, das
   nicht walkable ist, sodass Anwendung nicht ausgelöst wird
 - Wegfindung läuft nun in einem Hintergrundthread
 - Die Figur läuft nun 4 statt 2 Schritte pro sekunde
This commit is contained in:
2014-05-07 23:36:21 +02:00
parent 0e2dbe54dc
commit 637bf538ef

View File

@@ -148,7 +148,11 @@ namespace WorldOfPeacecraft
public void MoveTo (int x, int y) public void MoveTo (int x, int y)
{ {
new Thread(() => WalkTo(x,y)).Start(); if (Map.GetTiles () [x, y].IsWalkable ()) {
Thread thread = new Thread (() => WalkTo (x, y));
thread.IsBackground = true;
thread.Start ();
}
} }
private void WalkTo (int x, int y) private void WalkTo (int x, int y)
@@ -158,7 +162,7 @@ namespace WorldOfPeacecraft
walker.SetCoords (path); walker.SetCoords (path);
while (walker.HasMoreSteps()) { while (walker.HasMoreSteps()) {
SenderBuffer.AddLine("ask:" + walker.NextStep()); SenderBuffer.AddLine("ask:" + walker.NextStep());
Thread.Sleep(500); Thread.Sleep(250);
} }
} }