Добавление интерфейса

This commit is contained in:
Артём Алейкин 2022-10-04 18:24:13 +04:00
parent cf4b1b18ec
commit b83531e445
3 changed files with 66 additions and 0 deletions

View File

@ -130,5 +130,10 @@ namespace AirBomber
_startPosY = _pictureHeight.Value - _airBomberHeight;
}
}
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
{
return (_startPosX, _startPosY, _startPosX + _airBomberWidth, _airBomberHeight);
}
}
}

View File

@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AirBomber
{
internal class DrawningObjectBomber : IDrawningObject
{
private DrawningBomber _airBomber = null;
public DrawningObjectBomber(DrawningBomber airBomber)
{
_airBomber = airBomber;
}
public float Step => _airBomber?.AirBomber?.Step ?? 0;
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
{
return _airBomber?.GetCurrentPosition() ?? default;
}
public void MoveObject(Direction direction)
{
_airBomber?.MoveTransport(direction);
}
public void SetObject(int x, int y, int width, int height)
{
_airBomber.SetPosition(x, y, width, height);
}
public void DrawningObject(Graphics g)
{
}
}
}

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AirBomber
{
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();
}
}