示例#1
0
 public Form1()
 {
     InitializeComponent();
     ObjekteErstellen();
     startingLocation = vorgarten;
     aktuellerOrt     = startingLocation;
     ZuOrtGehen(aktuellerOrt);
 }
示例#2
0
 public bool Check(Ort locationToCheck)
 {
     if (locationToCheck == this.myLocation)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#3
0
 private void RedrawForm()
 {
     beschreibung.Text     = null;
     aktuellerOrt          = startingLocation;
     feind                 = new Opponent(vorgarten);
     check.Visible         = false;
     hide.Visible          = true;
     durchTürGehen.Visible = false;
     hierhinGehen.Visible  = false;
     ausgänge.Visible      = false;
 }
示例#4
0
        public void ZuOrtGehen(Ort neuerOrt)
        {
            aktuellerOrt = neuerOrt;
            ausgänge.Items.Clear();
            for (int i = 0; i < aktuellerOrt.Ausgänge.Length; i++)
            {
                ausgänge.Items.Add(aktuellerOrt.Ausgänge[i].Name);
            }
            ausgänge.SelectedIndex = 0;
            beschreibung.Text      = aktuellerOrt.Beschreibung;

            checkButtons(aktuellerOrt);
        }
示例#5
0
        private void checkButtons(Ort currentLocation)
        {
            if (currentLocation is IHatAußentür)
            {
                durchTürGehen.Visible = true;
            }
            else
            {
                durchTürGehen.Visible = false;
            }

            if (currentLocation is IHidingPlace)
            {
                check.Visible = true;
            }
            else
            {
                check.Visible = false;
            }
        }
示例#6
0
        public void Move()
        {
            bool hidden = false;

            while (!hidden)
            {
                if (myLocation is IHatAußentür)
                {
                    IHatAußentür locationWithDoor = myLocation as IHatAußentür;
                    if (random.Next(2) == 1)
                    {
                        myLocation = locationWithDoor.TürOrt;
                    }
                }

                int rand = random.Next(myLocation.Ausgänge.Length);
                myLocation = myLocation.Ausgänge[rand];

                if (myLocation is IHidingPlace)
                {
                    hidden = true;
                }
            }
        }
示例#7
0
 public Opponent(Ort startingLocation)
 {
     random     = new Random();
     myLocation = startingLocation;
 }