final step
This commit is contained in:
parent
090d961ce9
commit
5526cd9bc4
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base
|
||||
{
|
||||
internal abstract class AbstractMap
|
||||
internal abstract class AbstractMap : IEquatable<AbstractMap>
|
||||
{
|
||||
private IDrawningObject _drawningObject = null;
|
||||
protected int[,] _map = null;
|
||||
@ -131,5 +131,45 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base
|
||||
protected abstract void GenerateMap();
|
||||
protected abstract void DrawRoadPart(Graphics g, int i, int j);
|
||||
protected abstract void DrawBarrierPart(Graphics g, int i, int j);
|
||||
|
||||
public bool Equals(AbstractMap? other)
|
||||
{
|
||||
if (other == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var otherMap = other as AbstractMap;
|
||||
if (otherMap == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (_width != otherMap._width)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (_height != otherMap._height)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (_size_x != otherMap._size_x)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (_size_y != otherMap._size_y)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < _map.GetLength(0); i++)
|
||||
{
|
||||
for (int j = 0; j < _map.GetLength(1); j++)
|
||||
{
|
||||
if (_map[i, j] != otherMap._map[i, j])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,22 +41,6 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base
|
||||
{
|
||||
return colorCompare;
|
||||
}
|
||||
if (xBoat.GetBoat.GetType().Name != yBoat.GetBoat.GetType().Name)
|
||||
{
|
||||
if (xBoat.GetBoat.GetType().Name == "DrawningBoat")
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
if (xBoat.GetBoat.Boat is EntitySpeedboat xSpeedBoat && xBoat.GetBoat.Boat is EntitySpeedboat ySpeedBoat)
|
||||
{
|
||||
var colorAdvCompare = xSpeedBoat.DopColor.Name.CompareTo(ySpeedBoat.DopColor.Name);
|
||||
if (colorAdvCompare != 0)
|
||||
{
|
||||
return colorAdvCompare;
|
||||
}
|
||||
}
|
||||
var speedCompare = xBoat.GetBoat.Boat.Speed.CompareTo(yBoat.GetBoat.Boat.Speed);
|
||||
if (speedCompare != 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user