Сделано
This commit is contained in:
parent
650433518e
commit
a2997fa460
@ -55,7 +55,7 @@ width, int height, int airplaneWidth, int airplaneHeight)
|
||||
return;
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
if (x < 0 || y < 0 || x + _airplaneWidth >= _pictureWidth || y + _airplaneHeight >= _pictureHeight || y -_airplanewingHeight < 0 )
|
||||
if (x + _airplaneWidth >= _pictureWidth || y + _airplaneHeight >= _pictureHeight)
|
||||
{
|
||||
_startPosX = 1;
|
||||
_startPosY = (_airplanewingHeight+_airplanerwingkorpusHeight)/2;
|
||||
|
@ -1,5 +1,4 @@
|
||||
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
@ -1,7 +1,6 @@
|
||||
using ProjectAirFighter.MovementStrategy;
|
||||
using ProjectAirFighter.DrawningObjects;
|
||||
|
||||
|
||||
namespace ProjectAirFighter
|
||||
{
|
||||
public partial class FormAirFighter : Form
|
||||
@ -34,7 +33,7 @@ namespace ProjectAirFighter
|
||||
random.Next(1000, 3000),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
pictureBoxAirFighter.Width, pictureBoxAirFighter.Height);
|
||||
_drawningAirplane.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
_drawningAirplane.SetPosition(random.Next(10, 100), random.Next(70, 100));
|
||||
|
||||
Draw();
|
||||
}
|
||||
@ -48,7 +47,7 @@ namespace ProjectAirFighter
|
||||
Convert.ToBoolean(random.Next(0, 2)),
|
||||
Convert.ToBoolean(random.Next(0, 2)),
|
||||
pictureBoxAirFighter.Width, pictureBoxAirFighter.Height);
|
||||
_drawningAirplane.SetPosition(random.Next(10, 100), random.Next(10,100));
|
||||
_drawningAirplane.SetPosition(random.Next(10, 100), random.Next(70, 100));
|
||||
Draw();
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,6 @@ namespace ProjectAirFighter.MovementStrategy
|
||||
{
|
||||
public class MoveToBorder : AbstractStrategy
|
||||
{
|
||||
|
||||
protected override bool IsTargetDestinaion()
|
||||
{
|
||||
var objParams = GetObjectParameters;
|
||||
@ -19,7 +18,7 @@ namespace ProjectAirFighter.MovementStrategy
|
||||
return false;
|
||||
}
|
||||
|
||||
return objParams.RightBorder < FieldWidth && objParams.RightBorder + GetStep() >= FieldWidth &&
|
||||
return objParams.RightBorder <= FieldWidth && objParams.RightBorder + GetStep() >= FieldWidth &&
|
||||
objParams.DownBorder + GetStep() >= FieldHeight;
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,4 @@ namespace ProjectAirFighter
|
||||
Application.Run(new FormAirFighter());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user