Kashin M.I. Lab work 8 #8
@ -38,5 +38,32 @@ namespace GasolineTanker
|
||||
}
|
||||
public string GetInfo() => _gasolineTanker?.GetDataForSave();
|
||||
public static IDrawingObject Create(string data) => new DrawingObjectGasolineTanker(data.CreateDrawingGasolineTanker());
|
||||
|
||||
public bool Equals(IDrawingObject? other)
|
||||
{
|
||||
if (other is not DrawingObjectGasolineTanker otherGasolineTanker)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var entity = ;
|
||||
var otherEntity = otherGasolineTanker.;
|
||||
if (entity.GetType() != otherEntity.GetType() ||
|
||||
entity.Speed != otherEntity.Speed ||
|
||||
entity.Weight != otherEntity.Weight ||
|
||||
entity.BodyColor != otherEntity.BodyColor)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (entity is EntityImprovedGasolineTanker entityImprovedGasolineTanker &&
|
||||
otherEntity is EntityImprovedGasolineTanker otherEntityWarmlyShip && (
|
||||
entityImprovedGasolineTanker.BodyColor != otherEntityWarmlyShip.BodyColor ||
|
||||
entityImprovedGasolineTanker.DopColor != otherEntityWarmlyShip.DopColor ||
|
||||
entityImprovedGasolineTanker.BodyKit != otherEntityWarmlyShip.BodyKit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace GasolineTanker
|
||||
{
|
||||
internal interface IDrawingObject
|
||||
internal interface IDrawingObject : IEquatable<IDrawingObject>
|
||||
{
|
||||
public float Step { get; }
|
||||
void SetObject(int x, int y, int width, int height);
|
||||
|
Loading…
Reference in New Issue
Block a user