diff --git a/ProjectCatamaran/ProjectCatamaran/CollectionGenericObjects/AbstractCompany.cs b/ProjectCatamaran/ProjectCatamaran/CollectionGenericObjects/AbstractCompany.cs index 25b7fec..bf35846 100644 --- a/ProjectCatamaran/ProjectCatamaran/CollectionGenericObjects/AbstractCompany.cs +++ b/ProjectCatamaran/ProjectCatamaran/CollectionGenericObjects/AbstractCompany.cs @@ -9,13 +9,11 @@ namespace ProjectCatamaran.CollectionGenericObjects; public abstract class AbstractCompany { protected readonly int _placeSizeWidth = 90; - protected readonly int _placeSizeHeight = 50; protected readonly int _pictureWidth; protected readonly int _pictureHeight; protected ICollectionGenericObjects _collection = null; private int GetMaxCount => (_pictureWidth / _placeSizeWidth + 1) * (_pictureHeight / _placeSizeHeight / 2) - (_pictureHeight / _placeSizeHeight / 2); - public AbstractCompany(int picWidth,int picHeight,ICollectionGenericObjects collection) { _pictureWidth = picWidth; @@ -23,23 +21,19 @@ public abstract class AbstractCompany _collection = collection; _collection.SetMaxCount = GetMaxCount; } - public static int operator +(AbstractCompany company, DrawningBoat boat) { return company._collection?.Insert(boat) ?? -1; } - public static DrawningBoat? operator -(AbstractCompany company, int position) { return company._collection?.Remove(position); } - public DrawningBoat? GetRandomObject() { Random rnd = new Random(); return _collection?.Get(rnd.Next(GetMaxCount)); } - public Bitmap Show() { Bitmap bitmap = new(_pictureWidth, _pictureHeight); diff --git a/ProjectCatamaran/ProjectCatamaran/CollectionGenericObjects/Harbour.cs b/ProjectCatamaran/ProjectCatamaran/CollectionGenericObjects/Harbour.cs index 26bee8e..06bddaa 100644 --- a/ProjectCatamaran/ProjectCatamaran/CollectionGenericObjects/Harbour.cs +++ b/ProjectCatamaran/ProjectCatamaran/CollectionGenericObjects/Harbour.cs @@ -11,7 +11,6 @@ public class Harbour : AbstractCompany public Harbour(int picWidth, int picHeight, ICollectionGenericObjects collection) : base(picWidth, picHeight, collection) { } - protected override void DrawBackground(Graphics g) { Pen pen = new Pen(Color.Black,2); @@ -26,7 +25,6 @@ public class Harbour : AbstractCompany } } } - protected override void SetObjectPosition() { int curPosX = 0; @@ -49,7 +47,6 @@ public class Harbour : AbstractCompany curPosX = 0; curPosY++; } - } } } diff --git a/ProjectCatamaran/ProjectCatamaran/CollectionGenericObjects/MassiveGenericObjects.cs b/ProjectCatamaran/ProjectCatamaran/CollectionGenericObjects/MassiveGenericObjects.cs index 64274ba..e69bbfd 100644 --- a/ProjectCatamaran/ProjectCatamaran/CollectionGenericObjects/MassiveGenericObjects.cs +++ b/ProjectCatamaran/ProjectCatamaran/CollectionGenericObjects/MassiveGenericObjects.cs @@ -10,7 +10,6 @@ public class MassiveGenericObjects : ICollectionGenericObjects where T : c { private T?[] _collection; public int Count => _collection.Length; - public int SetMaxCount { set @@ -21,7 +20,6 @@ public class MassiveGenericObjects : ICollectionGenericObjects where T : c } } } - public MassiveGenericObjects() { _collection = Array.Empty(); @@ -35,7 +33,7 @@ public class MassiveGenericObjects : ICollectionGenericObjects where T : c } return null; - } + } public int Insert(T obj) { //todo @@ -50,7 +48,6 @@ public class MassiveGenericObjects : ICollectionGenericObjects where T : c return -1; } - public int Insert(T obj, int position) { //todo @@ -83,7 +80,6 @@ public class MassiveGenericObjects : ICollectionGenericObjects where T : c } return -1; } - public T? Remove(int position) { if (!(position >= 0 && position < _collection.Length) || _collection[position] == null ) diff --git a/ProjectCatamaran/ProjectCatamaran/Drawnings/DrawningBoat.cs b/ProjectCatamaran/ProjectCatamaran/Drawnings/DrawningBoat.cs index bcabe4f..f9f0a7e 100644 --- a/ProjectCatamaran/ProjectCatamaran/Drawnings/DrawningBoat.cs +++ b/ProjectCatamaran/ProjectCatamaran/Drawnings/DrawningBoat.cs @@ -73,7 +73,6 @@ public class DrawningBoat public DrawningBoat(int speed, double weight, Color bodyColor) : this() { EntityBoat = new EntityBoat(speed, weight, bodyColor); - } /// /// Конструктор @@ -84,7 +83,6 @@ public class DrawningBoat { _drawningBoatWidth = drawningBoatWidth; _drawningBoatHeight = drawningBoatHeight; - } /// /// установка границ поля