finish
This commit is contained in:
parent
aa2788a3ac
commit
6ffdf8d9a4
@ -14,8 +14,6 @@ namespace DumpTruck.DrawningObjects
|
||||
{
|
||||
public class DrawningDumpTruck : DrawningCar
|
||||
{
|
||||
|
||||
|
||||
public DrawningDumpTruck(int speed, double weight, Color bodyColor, Color additionalColor, bool bodyKit, bool tent, int width, int height): base(speed, weight, bodyColor, width, height, 110, 60)
|
||||
{
|
||||
if (EntityCar != null)
|
||||
@ -23,8 +21,7 @@ namespace DumpTruck.DrawningObjects
|
||||
EntityCar = new EntityDumpTruck(speed, weight, bodyColor,additionalColor, bodyKit, tent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityCar is not EntityDumpTruck dumpTruck)
|
||||
|
@ -41,7 +41,6 @@ namespace DumpTruck.DrawningObjects
|
||||
/// </summary>
|
||||
public int GetHeight => _carHeight;
|
||||
|
||||
|
||||
public DrawningCar(int speed, double weight, Color bodyColor, int width, int height)
|
||||
{
|
||||
if(width < _carWidth || height < _carHeight)
|
||||
@ -52,9 +51,6 @@ namespace DumpTruck.DrawningObjects
|
||||
_pictureHeight = height;
|
||||
|
||||
EntityCar = new EntityCar(speed, weight, bodyColor);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected DrawningCar(int speed, double weight, Color bodyColor, int
|
||||
@ -129,7 +125,6 @@ width, int height, int carWidth, int carHeight)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public virtual void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityCar == null)
|
||||
@ -146,7 +141,6 @@ width, int height, int carWidth, int carHeight)
|
||||
g.FillEllipse(brush, _startPosX, _startPosY + 35 + 10, 15, 15);
|
||||
g.FillEllipse(brush, _startPosX + 15, _startPosY + 35 + 10, 15, 15);
|
||||
g.FillEllipse(brush, _startPosX + 95, _startPosY + 35 + 10, 15, 15);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,12 +26,10 @@ namespace DumpTruck.Entities
|
||||
/// Признак (опция) наличия tent
|
||||
/// </summary>
|
||||
public bool Tent { get; private set; }
|
||||
|
||||
|
||||
public EntityDumpTruck(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, bool bodyKit, bool tent) : base(speed, weight, bodyColor)
|
||||
{
|
||||
|
||||
{
|
||||
AdditionalColor = additionalColor;
|
||||
BodyKit = bodyKit;
|
||||
Tent = tent;
|
||||
|
2
DumpTruck/DumpTruck/Form1.Designer.cs
generated
2
DumpTruck/DumpTruck/Form1.Designer.cs
generated
@ -142,7 +142,7 @@
|
||||
this.comboBoxStrategy.Name = "comboBoxStrategy";
|
||||
this.comboBoxStrategy.Size = new System.Drawing.Size(164, 23);
|
||||
this.comboBoxStrategy.TabIndex = 9;
|
||||
this.comboBoxStrategy.SelectedIndexChanged += new System.EventHandler(this.comboBoxStrategy_SelectedIndexChanged);
|
||||
|
||||
//
|
||||
// buttonStep
|
||||
//
|
||||
|
@ -15,12 +15,6 @@ namespace DumpTruck
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void button_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void Draw()
|
||||
{
|
||||
if (_drawningCar == null)
|
||||
@ -69,7 +63,6 @@ namespace DumpTruck
|
||||
_drawningCar.SetPosition(random.Next(10, 100), random.Next(10,
|
||||
100));
|
||||
Draw();
|
||||
|
||||
}
|
||||
|
||||
private void buttonDumpTruck_Click(object sender, EventArgs e)
|
||||
@ -124,12 +117,6 @@ namespace DumpTruck
|
||||
comboBoxStrategy.Enabled = true;
|
||||
_abstractStrategy = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void comboBoxStrategy_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,19 +29,29 @@ namespace DumpTruck.MovementStrategy
|
||||
{
|
||||
return;
|
||||
}
|
||||
var diffX = FieldWidth - objParams.ObjectMiddleHorizontal;
|
||||
var diffX = objParams.RightBorder - FieldWidth;
|
||||
if (Math.Abs(diffX) > GetStep())
|
||||
{
|
||||
|
||||
if (diffX > 0)
|
||||
{
|
||||
MoveLeft();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveRight();
|
||||
|
||||
}
|
||||
}
|
||||
var diffY = FieldHeight - objParams.ObjectMiddleVertical;
|
||||
var diffY = objParams.DownBorder - FieldHeight;
|
||||
if (Math.Abs(diffY) > GetStep())
|
||||
{
|
||||
|
||||
if (diffY > 0)
|
||||
{
|
||||
MoveUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveDown();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user