LabWork_02 #3

Closed
maxnes3 wants to merge 14 commits from LabWork_02 into LabWork_01
3 changed files with 62 additions and 0 deletions
Showing only changes of commit 4356388162 - Show all commits

View File

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

View File

@ -114,5 +114,10 @@ namespace WarmlyShip
}
}
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
{
return (_startPosX, _startPosY, _startPosX + _warmlyShipWidth, _startPosY + _warmlyShipHeight);
}
}
}

View File

@ -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();
}
}