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

This commit is contained in:
Данила Селяев 2022-09-25 21:06:23 +04:00
parent c5b3864190
commit b9ca34ea50
3 changed files with 63 additions and 0 deletions

View File

@ -128,5 +128,9 @@ namespace Locomative
_startPosY = _pictureHeight.Value - _locoHeight;
}
}
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
{
return (_startPosX, _startPosY, _startPosX + _locoWidth, _startPosY + _locoHeight);
}
}
}

View File

@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Locomative
{
internal class DrawningObjectLoco : IDrawningObject
{
private DrawningLocomative _loco = null;
public DrawningObjectLoco(DrawningLocomative loco)
{
_loco = loco;
}
public float Step => _loco?.Locomative?.Step ?? 0;
public void DrawningObject(Graphics g)
{
throw new NotImplementedException();
}
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
{
return _loco?.GetCurrentPosition() ?? default;
}
public void MoveObject(Direction direction)
{
_loco.MoveTransport(direction);
}
public void SetObject(int x, int y, int width, int height)
{
_loco.SetPosition(x, y, width, height);
}
void IDrawningObject.DrawningObject(Graphics g)
{
//сделать
}
}
}

View File

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