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; } } }
private void durchTürGehen_Click(object sender, EventArgs e) { IHatAußentür mitTür = aktuellerOrt as IHatAußentür; ZuOrtGehen(mitTür.TürOrt); }