Aleikin A.M. LabWork02 #2
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
40
AirBomber/AirBomber/DrawningObjectBomber.cs
Normal file
40
AirBomber/AirBomber/DrawningObjectBomber.cs
Normal 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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
21
AirBomber/AirBomber/IDrawningObject.cs
Normal file
21
AirBomber/AirBomber/IDrawningObject.cs
Normal 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();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user