Ejemplo n.º 1
0
        private void CheckForBats()
        {
            if (BatPositions.Contains(Player.Position))
            {
                Random   random = new Random();
                Position p;

                do
                {
                    p = new Position(random.Next() % TableSize, random.Next() % TableSize);
                } while(BatPositions.Contains(p) || PitPositions.Contains(p) || _table[p.X, p.Y].Wumpus);

                Position oldPos = new Position(Player.Position);

                Player.Position = p;

                if (OnStep != null)
                {
                    OnStep(this, new WumpusEventArgs {
                        OldPosition = oldPos, NewPosition = Player.Position
                    });
                }

                CheckNearby();

                //MessageBox.Show("A denevérek átdobtak.", "Figyelmeztetés", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Ejemplo n.º 2
0
        private void CheckForPit()
        {
            if (PitPositions.Contains(Player.Position))
            {
                IsGameOn = false;

                if (OnGameWon != null)
                {
                    OnGameWon(this, EventArgs.Empty);
                }

                MessageBox.Show("Leestél egy lyukba!", "Játék vége", MessageBoxButton.OK, MessageBoxImage.Stop);
            }
        }