You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.3 KiB
C#

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;
}
}
}