Presnyakova V.V Lab_8 #17
@ -20,6 +20,35 @@ namespace Catamaran
|
||||
{
|
||||
return _catamaran?.GetCurrentPosition() ?? default;
|
||||
}
|
||||
|
||||
public bool Equals(IDrawingObject ? other)
|
||||
{
|
||||
if (other == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var otherCar = other as DrawingObjectBoat;
|
||||
if (otherCar == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var car = _car.Car;
|
||||
var otherCarCar = otherCar._car.Car;
|
||||
if (car.Speed != otherCarCar.Speed)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (car.Weight != otherCarCar.Weight)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (car.BodyColor != otherCarCar.BodyColor)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// TODO доделать проверки в случае продвинутого объекта
|
||||
return true;
|
||||
}
|
||||
public void MoveObject(Direction direction)
|
||||
{
|
||||
_catamaran?.MoveTransport(direction);
|
||||
|
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Catamaran
|
||||
{
|
||||
internal interface IDrawingObject
|
||||
internal interface IDrawingObject : IEquatable<IDrawingObject>
|
||||
{
|
||||
/// <summary>
|
||||
/// Шаг перемещения объекта
|
||||
|
Loading…
Reference in New Issue
Block a user