Wegfindung wird jetzt ausgeführt, wenn auf ein Feld auf der Karte geklickt wird

This commit is contained in:
2014-05-07 19:39:18 +02:00
parent 117c9e601c
commit 0e2dbe54dc
5 changed files with 49 additions and 9 deletions

View File

@@ -13,6 +13,11 @@ namespace WorldOfPeacecraft
Coords = null;
}
public bool HasMoreSteps()
{
return Coords != null && Coords.Count >= 2;
}
public string NextStep ()
{
if (Coords == null) {
@@ -30,13 +35,13 @@ namespace WorldOfPeacecraft
}
string command;
if (src.X > dst.X) {
command = "mv:dwn";
} else if (src.X < dst.X) {
command = "mv:up";
} else if (src.Y > dst.Y) {
command = "mv:lft";
} else if (src.Y < dst.Y) {
} else if (src.X < dst.X) {
command = "mv:rgt";
} else if (src.Y > dst.Y) {
command = "mv:up";
} else if (src.Y < dst.Y) {
command = "mv:dwn";
} else {
command = NextStep ();
}