namespace ProjectAntiAircraftGun { public class AntiAircraft : GameObject { private int _speed; private int _weight; private Color _firstCol; private Color _secondCol; private int _numOfRollers; private int _step; public int Speed { get => _speed;} public int Weight { get => _weight;} public Color FirstColor { get => _firstCol; } public Color SecondColor { get => _secondCol; } public int NumOfRollers { get => _numOfRollers; } public int Step { get => _step>0?_step:1; } public AntiAircraft() { _speed = 1; _weight = 1; _firstCol = Color.Magenta; _secondCol = Color.Black; _numOfRollers = 6; try { _step = _speed / _weight; }catch(Exception e) { throw new Exception("Дурашка, какой ноль в весе?"); } } /// /// /// /// /// (0,int.MaxValue] /// /// /// [2,6] /// public AntiAircraft(int speed, int weight, Color firstCol, Color secondCol, int numOfRollers) { if (numOfRollers < 2 || numOfRollers > 6) throw new Exception("numOfRollers out of range [2,6]"); _speed = speed; _weight = weight; _firstCol = firstCol; _secondCol = secondCol; _numOfRollers = numOfRollers; try { _step = _speed / _weight; } catch (Exception e) { throw new Exception("Дурашка, какой ноль в весе?"); } } /// /// /// /// /// (0,int.MaxValue] /// public AntiAircraft(int speed, int weight, Color firstCol) { _speed = speed; _weight = weight; _firstCol = firstCol; _numOfRollers = 6; try { _step = _speed / _weight; } catch (Exception e) { throw e; } } } }