Example #1
0
        public bool Walk(Direction dir) {
            if (!CanWalk(dir))
                return false;

            position = position[dir].OtherSide;
            position.Seen = true;

            if (OnChange != null)
                OnChange(this);

            return true;
        }
Example #2
0
 public static int ToInt(Direction dir) {
     return dir == NORTH ? 0 :
            dir ==  WEST ? 1 :
            dir ==  EAST ? 2 :
            dir == SOUTH ? 3 : -1;
 }
Example #3
0
 public MazeLink this[Direction dir] {
     get { return exits[dir.AsInt]; }
 }
Example #4
0
 public MazeLink(Direction dir, bool walled) {
     direction = dir;
     wall = walled;
 }
 public String ReportWalk(Direction dir) {
     return String.Format(
         "You walk to the {0}.\n{1}",
         dir, ReportLook
     );
 }
Example #6
0
 public bool CanWalk(Direction dir) {
     return !position[dir].Wall;
 }