public bool Check(Location location)
 {
     if (location.Name == myLocation.Name)
         return true;
     else
         return false;
 }
        public bool Check(Location location)
        {
            if (myLocation == location)
                return true;

            else
                return false;
        }
Exemple #3
0
 private void MoveToANewLocation(Location newLocation)
 {
     currentLocation = newLocation;
     comboBox1.Items.Clear();
     for (int i = 0; i < currentLocation.Exits.Length; i++)
         comboBox1.Items.Add(currentLocation.Exits[i].Name);
     comboBox1.SelectedIndex = 0;
     textBox1.Text = currentLocation.Description ;
     if (currentLocation is IHasExteriorDoor)
         button2.Visible = true;
     else
        button2.Visible = false;
 }
Exemple #4
0
        private void MoveToANewLocation(Location location)
        {
            currentLocation = location;
            comboBoxLocation.Items.Clear();

            foreach(Location l in currentLocation.Exits)
            {
                comboBoxLocation.Items.Add(l.Name);
            }
            comboBoxLocation.SelectedIndex = 0;
            textBoxDescription.Text = currentLocation.Description;
            buttonGoThroughDoor.Visible = (currentLocation is IHasExteriorDoor);
        }
        private void MoveToANewLocation(Location newLocation)
        {
            this.currentLocation = newLocation;

            exits.Items.Clear();
            for (int i = 0; i < currentLocation.Exits.Length; i++)
                exits.Items.Add(currentLocation.Exits[i].Name);
            exits.SelectedIndex = 0;

            description.Text = currentLocation.Description;

            if (currentLocation is IHasExteriorDoor)
                goThroughTheDoor.Visible = true;
            else
                goThroughTheDoor.Visible = false;
        }
        public void Move()
        {
            bool hidden = false;
            while (!hidden)
            {
                if (myLocation is IHasExteriorDoor)
                {
                    IHasExteriorDoor locationWithDoor = myLocation as IHasExteriorDoor;

                    if (random.Next(2) == 1)
                        myLocation = locationWithDoor.DoorLocation;
                }
                int rand = random.Next(myLocation.Exits.Length);
                myLocation = myLocation.Exits[rand];
                if (myLocation is IHidingPlace)
                    hidden = true;
            }
        }
        public void Move()
        {
            bool hidden = false;

            while (!hidden)
            {
                if (myLocation is IHasExteriorDoor)
                {
                    if (random.Next(2) == 1)
                    {
                        IHasExteriorDoor nextLocation = myLocation as IHasExteriorDoor;
                        myLocation = nextLocation.DoorLocation;
                    }
                }

                myLocation = myLocation.Exits[random.Next(myLocation.Exits.Length)];
                if (myLocation is IHidingPlace)
                    hidden = true;
            }
        }
        private void MoveToANewLocation(Location newLocation)
        {
            moves++;
            currentLocation = newLocation;

            RedrawForm();
        }
 public Opponent(Location startingLocation)
 {
     myLocation = startingLocation;
     random = new Random();
 }