+ case AiState.Pacing:\r
+\r
+ Direction direction = GetDirectionToNextCell();\r
+ Point destination = MovementManager.GetNeighbor(Coordinates, direction);\r
+\r
+ if (mGame.IsCellOpen(destination))\r
+ {\r
+ mMotion.Update(timeSpan, direction);\r
+ }\r
+ else\r
+ {\r
+ if (mGame.CurrentFrameNumber % mRetryInterval == 0)\r
+ {\r
+ // Something is in our way, so let's chart a new course.\r
+ ChartPath();\r
+\r
+ direction = GetDirectionToNextCell();\r
+ /*if (direction == Direction.None)\r
+ {\r
+ // If we still can't chart a course, just stand there\r
+ // and try to chart again later.\r
+ mState = AiState.Standing;\r
+ }*/\r
+\r
+ mMotion.Update(timeSpan, direction);\r
+ }\r
+ else mMotion.Update(timeSpan);\r
+ }\r
+\r
+ break;\r
+\r
+ case AiState.Standing:\r
+\r
+ mMotion.Update(timeSpan);\r
+ break;\r