Lisov N.A. Lab_work2 #2
@ -241,5 +241,10 @@ namespace AirFighter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
|
||||
{
|
||||
return (_startPosX, _startPosY, _startPosX + _aircraftWidth, _startPosY + _aircraftHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
42
AirFighter/DrawingObjectAircraft.cs
Normal file
42
AirFighter/DrawingObjectAircraft.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AirFighter
|
||||
{
|
||||
internal class DrawingObjectAircraft : IDrawingObject
|
||||
{
|
||||
private DrawingAircraft _aircraft = null;
|
||||
|
||||
public DrawingObjectAircraft(DrawingAircraft aircraft)
|
||||
{
|
||||
_aircraft = aircraft;
|
||||
}
|
||||
|
||||
public float Step => _aircraft.Plane?.Step ?? 0;
|
||||
|
||||
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
|
||||
{
|
||||
return _aircraft?.GetCurrentPosition() ?? default;
|
||||
}
|
||||
|
||||
public void MoveObject(Direction direction)
|
||||
{
|
||||
_aircraft.MoveTransport(direction);
|
||||
}
|
||||
|
||||
public void SetObject(int x, int y, int width, int height)
|
||||
{
|
||||
_aircraft.SetPosition(x, y, width, height);
|
||||
}
|
||||
|
||||
void IDrawingObject.DrawingObject(Graphics g)
|
||||
{
|
||||
_aircraft.DrawTransport(g);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
21
AirFighter/IDrawingObject.cs
Normal file
21
AirFighter/IDrawingObject.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AirFighter
|
||||
{
|
||||
internal interface IDrawingObject
|
||||
{
|
||||
public float Step { get; }
|
||||
void SetObject(int x, int y, int width, int height);
|
||||
|
||||
void MoveObject(Direction direction);
|
||||
|
||||
void DrawingObject(Graphics g);
|
||||
|
||||
(float Left, float Right, float Top, float Bottom) GetCurrentPosition();
|
||||
eegov
commented
Дополнительное задание в итоговый код не включается Дополнительное задание в итоговый код не включается
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user
Дополнительное задание в итоговый код не включается