Пример #1
0
        private void generateLevelRooms()
        {
            try
            {
                //ligne lue
                var lignes = _layout.Replace("\r", "").Split('\n');

                // Lecture du fichier ligne par ligne
                int i = 0;

                foreach (string ligne in lignes)
                {
                    var roomTab = ligne.Split(';');
                    foreach (string room in roomTab)
                    {
                        Room r = new Room(i, int.Parse(room));
                        Rooms.Add(r);
                        i++;
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
Пример #2
0
        public void initialisePartie()
        {
            try
            {
                SoundManager.playTitleAmbience();

                this.CurrentLevel = LevelsManager.GetAllLevels()[0];
                this.CurrentRoom = this.CurrentLevel.GetRoom(this.CurrentLevel.StartRoomIndex);
                this.CurrentLevel.GetRoom(this.CurrentRoom.Position).Echo();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
        }
Пример #3
0
        public void deplaceJoueur(DIRECTIONS dir)
        {
            int direction = 0;

            switch (dir)
            {
                case DIRECTIONS.LEFT:
                    if (!CurrentRoom.WallLeft)
                        direction = -1;
                    break;

                case DIRECTIONS.UP:
                    if (!CurrentRoom.WallUp)
                        direction = -5;
                    break;

                case DIRECTIONS.RIGHT:
                    if (!CurrentRoom.WallRight)
                        direction = -1;
                    break;

                case DIRECTIONS.DOWN:
                    if (!CurrentRoom.WallDown)
                        direction = 5;
                    break;
            }

            if (direction == 0)
            {
                SoundManager.playSound(@"media\invalid.wav");
                Thread.Sleep(700);
            }
                
            CurrentRoom = CurrentLevel.Rooms[CurrentRoom.Position + direction];
            CurrentRoom.Echo();
        }