PIBD-11 Shipilov N.S. Seaplane LabWork01 Simple LabWork1 #1

Closed
NikitaShipilov wants to merge 5 commits from LabWork1 into main
3 changed files with 90 additions and 0 deletions
Showing only changes of commit 3a9fee87bb - Show all commits

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectSeaplane;
public enum DirectionType
{
Up = 1,
Down = 2,
Left = 3,
Right = 4,
}

View File

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectSeaplane;
public class DrawingSeaplane
{
public EntitySeaplane? EntitySeaplane {get;private set;}
private int? _pictureWidth;
private int? _pictureHeight;
private int? _startPosX;
private int? _startPosY;
private readonly int _drawingSeaplaneWidth = 0;
private readonly int _drawingSeaplaneHeight = 0;
public void Init (int speed, double weight, Color bodyColor, Color additionalColor)
{
EntitySeaplane = new EntitySeaplane();
EntitySeaplane.Init(speed, weight, bodyColor, additionalColor);
_pictureHeight = null;
_pictureWidth = null;
_startPosX = null;
_startPosY = null;
}
public bool SetPictureSize(int width, int height)
{
_pictureHeight = height;
_pictureWidth = width;
return true;
}
public void SetPosition(int x, int y)
{
if (!_pictureHeight.HasValue || !_pictureWidth.HasValue)
{
return;
}
_startPosY = y;
_startPosX = x;
}
}

View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectSeaplane;
public class EntitySeaplane
{
public int Speed { get; set; }
public double Weight { get; set; }
public Color BodyColor { get; private set; }
public Color AdditionalColor { get; private set; }
public double Step => Speed * 100 / Weight;
public void Init(int speed, double weight, Color bodyColor, Color additionalColor)
{
Speed = speed;
Weight = weight;
BodyColor = bodyColor;
AdditionalColor = additionalColor;
}
}