Добавил два класса и DirectionType
This commit is contained in:
parent
9c9afdda7b
commit
3a9fee87bb
16
ProjectSeaplane/ProjectSeaplane/DirectionType.cs
Normal file
16
ProjectSeaplane/ProjectSeaplane/DirectionType.cs
Normal 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,
|
||||
}
|
||||
|
51
ProjectSeaplane/ProjectSeaplane/DrawingSeaplane.cs
Normal file
51
ProjectSeaplane/ProjectSeaplane/DrawingSeaplane.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
|
23
ProjectSeaplane/ProjectSeaplane/EntitySeaplane.cs
Normal file
23
ProjectSeaplane/ProjectSeaplane/EntitySeaplane.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user