PIbd-14 Ivleev D.A. Lab01 #1
@ -13,6 +13,11 @@ public class DrawingMotorBoat
|
||||
/// </summary>
|
||||
public EntityMotorBoat? EntityMotorBoat { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Класс-сущность
|
||||
/// </summary>
|
||||
public EntityPaddle? EntityPaddle { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Ширина окна
|
||||
/// </summary>
|
||||
@ -54,10 +59,12 @@ public class DrawingMotorBoat
|
||||
/// <param name="inboardEngine"></param>
|
||||
/// <param name="paddle"></param>
|
||||
/// <param name="protectiveGlass"></param>
|
||||
public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool inboardEngine, bool paddle, bool protectiveGlass)
|
||||
public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool inboardEngine, bool protectiveGlass, int paddle)
|
||||
{
|
||||
EntityMotorBoat = new EntityMotorBoat();
|
||||
EntityMotorBoat.Init(speed, weight, bodyColor, additionalColor, inboardEngine, paddle, protectiveGlass);
|
||||
EntityMotorBoat.Init(speed, weight, bodyColor, additionalColor, inboardEngine, protectiveGlass);
|
||||
EntityPaddle = new EntityPaddle();
|
||||
EntityPaddle.Init(paddle);
|
||||
_pictureWidth = null;
|
||||
_pictureHeight = null;
|
||||
_startPosX = null;
|
||||
@ -245,17 +252,32 @@ public class DrawingMotorBoat
|
||||
}
|
||||
|
||||
// Вёсла
|
||||
if (EntityMotorBoat.Paddle)
|
||||
if (EntityPaddle.Paddle != 0)
|
||||
{
|
||||
g.DrawRectangle(pen, _startPosX.Value + 32, _startPosY.Value + 3, 2, 17);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 32, _startPosY.Value + 30, 2, 17);
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 33, _startPosY.Value + 3, 1, 17);
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 33, _startPosY.Value + 31, 1, 16);
|
||||
if (EntityPaddle.Paddle >= 1)
|
||||
{
|
||||
g.DrawRectangle(pen, _startPosX.Value + 32, _startPosY.Value + 3, 2, 17);
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 33, _startPosY.Value + 3, 1, 17);
|
||||
|
||||
g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value, 6, 8);
|
||||
g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value + 42, 6, 8);
|
||||
g.FillEllipse(additionalBrush, _startPosX.Value + 30, _startPosY.Value, 6, 8);
|
||||
g.FillEllipse(additionalBrush, _startPosX.Value + 30, _startPosY.Value + 42, 6, 8);
|
||||
g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value, 6, 8);
|
||||
g.FillEllipse(additionalBrush, _startPosX.Value + 30, _startPosY.Value, 6, 8);
|
||||
}
|
||||
if (EntityPaddle.Paddle >= 2)
|
||||
{
|
||||
g.DrawRectangle(pen, _startPosX.Value + 27, _startPosY.Value + 30, 2, 17);
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 28, _startPosY.Value + 31, 1, 16);
|
||||
|
||||
g.DrawEllipse(pen, _startPosX.Value + 25, _startPosY.Value + 42, 6, 8);
|
||||
g.FillEllipse(additionalBrush, _startPosX.Value + 25, _startPosY.Value + 42, 6, 8);
|
||||
}
|
||||
if (EntityPaddle.Paddle == 3)
|
||||
{
|
||||
g.DrawRectangle(pen, _startPosX.Value + 36, _startPosY.Value + 30, 2, 17);
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 37, _startPosY.Value + 31, 1, 16);
|
||||
|
||||
g.DrawEllipse(pen, _startPosX.Value + 34, _startPosY.Value + 42, 6, 8);
|
||||
g.FillEllipse(additionalBrush, _startPosX.Value + 34, _startPosY.Value + 42, 6, 8);
|
||||
}
|
||||
}
|
||||
|
||||
// Защитное стекло
|
||||
|
@ -30,10 +30,10 @@ public class EntityMotorBoat
|
||||
/// </summary>
|
||||
public bool InboardEngine { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Признак (опция) наличия вёсел
|
||||
/// </summary>
|
||||
public bool Paddle { get; private set; }
|
||||
///// <summary>
|
||||
///// Признак (опция) наличия вёсел
|
||||
///// </summary>
|
||||
//public int Paddle { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Возможность глиссирования
|
||||
@ -55,14 +55,30 @@ public class EntityMotorBoat
|
||||
/// <param name="inboardEngine"></param>
|
||||
/// <param name="inflatable"></param>
|
||||
/// <param name="planing"></param>
|
||||
public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool inboardEngine, bool paddle, bool protectiveGlass)
|
||||
public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool inboardEngine, bool protectiveGlass)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
AdditionalColor = additionalColor;
|
||||
InboardEngine = inboardEngine;
|
||||
Paddle = paddle;
|
||||
ProtectiveGlass = protectiveGlass;
|
||||
}
|
||||
}
|
||||
|
||||
public class EntityPaddle
|
||||
{
|
||||
/// <summary>
|
||||
/// Признак (опция) наличия вёсел
|
||||
/// </summary>
|
||||
public int Paddle { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Инициализация полей объекта-класса вёсел
|
||||
/// </summary>
|
||||
/// <param name="paddle"></param>
|
||||
public void Init(int paddle)
|
||||
{
|
||||
Paddle = paddle;
|
||||
}
|
||||
}
|
@ -47,7 +47,7 @@ public partial class FormMotorBoat : Form
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)),
|
||||
Convert.ToBoolean(random.Next(0, 2)));
|
||||
random.Next(0, 4));
|
||||
_drawingMotorBoat.SetPictureSize(pictureBoxMotorBoat.Width, pictureBoxMotorBoat.Height);
|
||||
_drawingMotorBoat.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user