Example #1
0
        public MainWindow()
        {
            InitializeComponent();
            m_manager = new GameManager(new GameManager.GameStateChangedDelgate(GameStateChanged), new GameManager.ShowHopDelegate(ShowHop));
            DataContext = this;

            InitializeTasks();
        }
Example #2
0
 private void GameStateChanged(GameManager.GameState newState)
 {
     bool stateChanged = GameStatus != newState;
     GameStatus = newState;
     UpdatePadViews();
     if (stateChanged)
     {
         if (newState == GameManager.GameState.Lost)
         {
             m_lostSound.Play();
         }
         else if (newState == GameManager.GameState.Won)
         {
             m_wonSound.Play();
         }
         else
         {
             m_swampSound.PlayLooping();
         }
     }
 }
Example #3
0
            public PadView(char padId, GameManager manager, Canvas pondCanvas, Random rng)
            {
                m_manager = manager;
                m_padId = padId;

                hallo = CreateHalloEllipse();
                pondCanvas.Children.Add(hallo);

                pad = CreatePadCanvas(rng);
                pondCanvas.Children.Add(pad);

                frog = CreateFrogEllipse();
                pondCanvas.Children.Add(frog);

                hitTest = CreateInvisibleHitTestEllipse();
                pondCanvas.Children.Add(hitTest);

                hitTest.MouseDown += new MouseButtonEventHandler(MouseDownHandler);
            }
Example #4
0
 static void GameStateChanged(GameManager.GameState newState)
 {
     RenderConsole();
     if (newState == GameManager.GameState.Lost)
     {
         Console.Beep(200, 800);
     }
     else if (newState == GameManager.GameState.Won)
     {
         Console.Beep();
         Console.Beep();
         Console.Beep();
     }
 }