예제 #1
0
        private void CreateObjects()
        {
            OutsideWithDoor quintalFrente = new OutsideWithDoor(false, "Quintal da Frente", "");
            OutsideWithHidingPlace jardim = new OutsideWithHidingPlace(false, "Jardim", "galpão");
            OutsideWithDoor quintalFundo = new OutsideWithDoor(true, "Quintal dos Fundos", "");
            RoomWithDoor salaEstar = new RoomWithDoor("Porta de entrada da frente", "Carpete Antigo", "Sala de Estar", "");
            Room salaJantar = new Room("Candelabro de Cristal", "Sala de Jantar");
            RoomWithDoor cozinha = new RoomWithDoor("Porta com Tela para fundos", "Detalhes em Aço Inox", "Cozinha", "");
            
            RoomWithDoor escadas = new RoomWithDoor("Escadas para Hall Superior", "Corrimão de Madeira", "Escadas", "");
            RoomWithDoor hallway = new RoomWithDoor("Escadas para sala de estar", "quadro de cachorro pulguento e armário", "Hall Superior", "");
            RoomWithHidingPlace quartoPrincipal = new RoomWithHidingPlace("cama grande", "Quarto Principal", "debaixo da cama");
            RoomWithHidingPlace quartoSecundario = new RoomWithHidingPlace("cama pequena", "Segundo quarto", "debaixo da cama");
            RoomWithHidingPlace banheiro = new RoomWithHidingPlace("pia e vaso sanitário", "Banheiro", "chuveiro");
            OutsideWithHidingPlace calcada = new OutsideWithHidingPlace(false, "Calçada", "garagem");

            quintalFrente.Exits = new Location[] { salaEstar, jardim, calcada };
            quintalFrente.DoorLocation = salaEstar;

            jardim.Exits = new Location[] { quintalFrente, quintalFundo };

            quintalFundo.Exits = new Location[] { cozinha, jardim, calcada };
            quintalFundo.DoorLocation = cozinha;

            calcada.Exits = new Location[] { quintalFrente, quintalFundo };

            salaEstar.Exits = new Location[] { quintalFrente, salaJantar, escadas };
            salaEstar.DoorLocation = quintalFrente;

            salaJantar.Exits = new Location[] { salaEstar, cozinha };

            cozinha.Exits = new Location[] { salaJantar, quintalFundo };
            cozinha.DoorLocation = quintalFundo;

            quartoPrincipal.Exits = new Location[] { hallway };

            quartoSecundario.Exits = new Location[] { hallway };

            escadas.Exits = new Location[] { hallway, salaEstar };
            escadas.DoorLocation = hallway;

            hallway.Exits = new Location[] { quartoPrincipal, quartoSecundario, banheiro, escadas };
            hallway.DoorLocation = escadas;

            _currentLocation = quintalFrente;

            _oponent = new Opponent(_currentLocation);
        }
예제 #2
0
        public void Move()
        {
            if (MyLocation is OutsideWithDoor)
            {
                if (_random.Next(2) == 1)
                {
                    _myLocation = ((OutsideWithDoor)MyLocation).Exits[_random.Next(((OutsideWithDoor)MyLocation).Exits.Count())];
                }                
            }

            if (MyLocation is RoomWithDoor)
            {
                _myLocation = ((RoomWithDoor)MyLocation).DoorLocation;
            }

            if (!(MyLocation is IHidingPlace))
            {
                Move();
            }
        }
예제 #3
0
        private void MoveToNewLocation(Location currentLocation)
        {
            _currentLocation = currentLocation;

            ddlExits.Items.Clear();

            for (int i = 0; i < _currentLocation.Exits.Length; i++)
            {
                ddlExits.Items.Add(_currentLocation.Exits[i].Name);
            }
            ddlExits.SelectedIndex = 0;

            txtDescription.Text = _currentLocation.Description;

            if (_currentLocation is IHasExteriorDoor)
            {
                btnGoThroughtTheDoor.Visible = true;
            }
            else
            {
                btnGoThroughtTheDoor.Visible = false;
            }
            NameCheckButton();
        }
예제 #4
0
 public bool Check(Location location)
 {
     return location == MyLocation;
 }
예제 #5
0
 public Opponent(Location myLocation)
 {
     _myLocation = myLocation;
     _random = new Random();            
 }