Добавил два класса и DirectionType

This commit is contained in:
ShipilovNikita 2024-02-05 11:23:37 +04:00
parent 9c9afdda7b
commit 3a9fee87bb
3 changed files with 90 additions and 0 deletions

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