Example #1
0
 public MazeViewModel()
 {
     try
     {
         isMulti = AppViewModel.CurrentGameIsMulti;
         speaker = AppViewModel.GetServerSpeaker();
         MakeMazeData();
         boxList = MakeBoxList();
         CallPropertyChanged("BoxList");
         player     = new PlayerViewModel(@"/Pictures/CalFinal.png", data.Start.Row, data.Start.Col, DisplayMazeHeight, DisplayMazeWidth);
         end        = new PlayerViewModel(@"/Pictures/redsquare.png", data.End.Row, data.End.Col, DisplayMazeHeight, DisplayMazeWidth);
         firstHint  = new PlayerViewModel(@"/Pictures/yellowsquare.png", data.Start.Row, data.Start.Col - 1, DisplayMazeHeight, DisplayMazeWidth);
         secondHint = new PlayerViewModel(@"/Pictures/yellowsquare.png", data.Start.Row, data.Start.Col - 2, DisplayMazeHeight, DisplayMazeWidth);
         // hintCalculator = new HintCalculator(player, firstHint, secondHint);
         keyUp    = new KeyUpCommand(this);
         keyDown  = new KeyDownCommand(this);
         keyRight = new KeyRightCommand(this);
         keyLeft  = new KeyLeftCommand(this);
     }
     catch (Exception e)
     {
         Console.WriteLine("Error in MazeViewModel constructor. " + e.ToString());
     }
     HintShow.LoadMazeViewModel(this);
 }
Example #2
0
 public void MoveDown()
 {
     KeyDown.CanExecute(false);
     CallPropertyChanged("KeyDown");
     HintShow.HideHint();
     player.Row = player.Row + 1;
     CallPropertyChanged("PlayerMargin");
     if (isMulti)
     {
         speaker.PlayCommand("down");
     }
     CheckIfWon();
     KeyDown.CanExecute(true);
     CallPropertyChanged("KeyDown");
 }
Example #3
0
 public void MoveRight()
 {
     KeyRight.CanExecute(false);
     CallPropertyChanged("KeyRight");
     HintShow.HideHint();
     player.Col = player.Col + 1;
     CallPropertyChanged("PlayerMargin");
     if (isMulti)
     {
         speaker.PlayCommand("right");
     }
     CheckIfWon();
     KeyRight.CanExecute(true);
     CallPropertyChanged("KeyRight");
 }