проверки в случае продвинутого объекта

This commit is contained in:
VictoriaPresnyakova 2022-12-04 17:50:08 +04:00
parent 8bd07b13ac
commit 68170b1023
2 changed files with 13 additions and 1 deletions

View File

@ -206,6 +206,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AbstractMap.cs" /> <Compile Include="AbstractMap.cs" />
<Compile Include="BoatCompareByColor.cs" />
<Compile Include="BoatCompareByType.cs" /> <Compile Include="BoatCompareByType.cs" />
<Compile Include="BoatNotFoundException.cs" /> <Compile Include="BoatNotFoundException.cs" />
<Compile Include="DrawingCatamaran.cs" /> <Compile Include="DrawingCatamaran.cs" />

View File

@ -47,7 +47,18 @@ namespace Catamaran
{ {
return false; return false;
} }
// TODO доделать проверки в случае продвинутого объекта
//доделать проверки в случае продвинутого объекта
var catamaran = boat as EntityCatamaran;
var otherCatamaran = otherBoatBoat as EntityCatamaran;
if (catamaran == null && otherCatamaran == null) return true;
if (catamaran == null || otherCatamaran == null) return false;
if (catamaran.DopColor != otherCatamaran.DopColor) return false;
if (catamaran.Sail != otherCatamaran.Sail) return false;
if (catamaran.Floats != otherCatamaran.Floats) return false;
return true; return true;
} }
public void MoveObject(Direction direction) public void MoveObject(Direction direction)