diff --git a/WarmlyShip/WarmlyShip/DrawningObjectShip.cs b/WarmlyShip/WarmlyShip/DrawningObjectShip.cs new file mode 100644 index 0000000..eaecf5e --- /dev/null +++ b/WarmlyShip/WarmlyShip/DrawningObjectShip.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WarmlyShip +{ + internal class DrawningObjectShip : IDrawningObject + { + private DrawningWarmlyShip _warmlyShip = null; + + public DrawningObjectShip(DrawningWarmlyShip warmlyShip) + { + _warmlyShip = warmlyShip; + } + + public float Step => _warmlyShip?.warmlyShip?.Step ?? 0; + + public void DrawningObject(Graphics g) + { + _warmlyShip?.DrawTransport(g); + } + + public (float Left, float Right, float Top, float Bottom) GetCurrentPosition() + { + return _warmlyShip?.GetCurrentPosition() ?? default; + } + + public void MoveObject(Direction direction) + { + _warmlyShip?.MoveTransport(direction); + } + + public void SetObject(int x, int y, int width, int height) + { + _warmlyShip?.SetPosition(x, y, width, height); + } + } +} diff --git a/WarmlyShip/WarmlyShip/DrawningWarmlyShip.cs b/WarmlyShip/WarmlyShip/DrawningWarmlyShip.cs index 74f0c7b..d6624ae 100644 --- a/WarmlyShip/WarmlyShip/DrawningWarmlyShip.cs +++ b/WarmlyShip/WarmlyShip/DrawningWarmlyShip.cs @@ -114,5 +114,10 @@ namespace WarmlyShip } } + + public (float Left, float Right, float Top, float Bottom) GetCurrentPosition() + { + return (_startPosX, _startPosY, _startPosX + _warmlyShipWidth, _startPosY + _warmlyShipHeight); + } } } diff --git a/WarmlyShip/WarmlyShip/IDrawningObject.cs b/WarmlyShip/WarmlyShip/IDrawningObject.cs new file mode 100644 index 0000000..a732b2c --- /dev/null +++ b/WarmlyShip/WarmlyShip/IDrawningObject.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WarmlyShip +{ + internal interface IDrawningObject + { + public float Step { get; } + void SetObject(int x, int y, int width, int height); + void MoveObject(Direction direction); + void DrawningObject(Graphics g); + (float Left, float Right, float Top, float Bottom) GetCurrentPosition(); + } +}