using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Threading; using System.Windows.Forms; namespace Übungen_LF6_WinFormanwendung { class AufzugKabine : Button { private int speed; public bool zielErreicht = false; public int KabinenSpeed { get { return this.speed; } set { this.speed = value; } } public AufzugKabine() { } public AufzugKabine(int newSpeed, int x_Pos, int y_Pos, string Name) { speed = newSpeed; this.Left = x_Pos; this.Top = y_Pos; this.Text = Name; } public bool fahren(int zielYpos, int richtung) { //Richtung +1 = runter // -1 = hoch if (this.Left <= zielYpos && speed > 0) { Application.DoEvents(); Thread.Sleep(100 - speed); if (richtung > 0) Top += 1; else Top -= 1; return true; } zielErreicht = true; return false; } } }