Presnyakova V.V Lab_8 #17

Closed
Victoria_Presnyakova wants to merge 12 commits from Lab_8 into Lab_7
2 changed files with 30 additions and 1 deletions
Showing only changes of commit 49a4f5fc8f - Show all commits

View File

@ -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);

View File

@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace Catamaran
{
internal interface IDrawingObject
internal interface IDrawingObject : IEquatable<IDrawingObject>
{
/// <summary>
/// Шаг перемещения объекта