2022-09-26 19:55:09 +04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Artilleries
|
|
|
|
|
{
|
2022-09-26 22:02:22 +04:00
|
|
|
|
internal class DrawingObjectArtillery : IDrawingObject
|
2022-09-26 19:55:09 +04:00
|
|
|
|
{
|
|
|
|
|
private DrawingArtillery _artillery = null;
|
|
|
|
|
|
2022-11-21 20:27:15 +04:00
|
|
|
|
public DrawingArtillery Artillery => _artillery;
|
|
|
|
|
|
2022-09-26 19:55:09 +04:00
|
|
|
|
public DrawingObjectArtillery(DrawingArtillery artillery)
|
|
|
|
|
{
|
|
|
|
|
_artillery = artillery;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float Step => _artillery?.Artillery?.Step ?? 0;
|
|
|
|
|
|
|
|
|
|
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
|
|
|
|
|
{
|
|
|
|
|
return _artillery?.GetCurrentPosition() ?? default;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void MoveObject(Direction direction)
|
|
|
|
|
{
|
|
|
|
|
_artillery?.MoveTransport(direction);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetObject(int x, int y, int width, int height)
|
|
|
|
|
{
|
|
|
|
|
_artillery.SetPosition(x, y, width, height);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void DrawingObject(Graphics g)
|
|
|
|
|
{
|
|
|
|
|
_artillery.DrawTransport(g);
|
|
|
|
|
}
|
2022-11-04 16:48:55 +04:00
|
|
|
|
|
|
|
|
|
public string GetInfo() => _artillery?.GetDateForSave();
|
|
|
|
|
|
|
|
|
|
public static IDrawingObject Create(string data) => new DrawingObjectArtillery(data.CreateDrawingArtillery());
|
2022-11-21 19:58:14 +04:00
|
|
|
|
|
|
|
|
|
public bool Equals(IDrawingObject? other)
|
|
|
|
|
{
|
|
|
|
|
if (other == null)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var otherArtillery = other as DrawingObjectArtillery;
|
|
|
|
|
|
|
|
|
|
if (otherArtillery == null)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var artillery = _artillery.Artillery;
|
|
|
|
|
var otherArtilleryArtillery = otherArtillery._artillery.Artillery;
|
|
|
|
|
|
|
|
|
|
if (artillery.GetType() != otherArtilleryArtillery.GetType())
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (artillery.Speed != otherArtilleryArtillery.Speed)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (artillery.Weight != otherArtilleryArtillery.Weight)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (artillery.BodyColor != otherArtilleryArtillery.BodyColor)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (artillery is EntityAdvancedArtillery advanced && otherArtilleryArtillery is EntityAdvancedArtillery otherAdvanced)
|
|
|
|
|
{
|
|
|
|
|
if (advanced.DopColor != otherAdvanced.DopColor)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (advanced.Weapon != otherAdvanced.Weapon)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (advanced.SalvoBattery != otherAdvanced.SalvoBattery)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2022-09-26 19:55:09 +04:00
|
|
|
|
}
|
|
|
|
|
}
|