Добавление интерфейса
This commit is contained in:
parent
8c5844e23b
commit
64280d0b6f
40
Warship/Warship/DrawningObjectLinkor.cs
Normal file
40
Warship/Warship/DrawningObjectLinkor.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Warship
|
||||
{
|
||||
public class DrawningObjectLinkor : IDrawningObject
|
||||
{
|
||||
private DrawningShip _ship;
|
||||
|
||||
public DrawningObjectLinkor(DrawningShip ship)
|
||||
{
|
||||
_ship = ship;
|
||||
}
|
||||
|
||||
public float Step => _ship.Ship.Step;
|
||||
|
||||
public void DrawningObject(Graphics g)
|
||||
{
|
||||
_ship.DrawTransport(g);
|
||||
}
|
||||
|
||||
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
|
||||
{
|
||||
return _ship?.GetCurrentPosition() ?? default;
|
||||
}
|
||||
|
||||
public void MoveObject(Direction direction)
|
||||
{
|
||||
_ship.MoveTransport(direction);
|
||||
}
|
||||
|
||||
public void SetObject(int x, int y, int width, int height)
|
||||
{
|
||||
_ship.SetPosition(x, y, width, height);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user