namespace ProjectLiner
{
public class Liner : GameObject
{
private int _speed;
private int _weight;
private Color _firstCol;
private Color _secondCol;
private int _numOfBoxes;
private bool _haveMark;
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 NumOfBoxes { get => _numOfBoxes; }
public int Step { get => _step>0?_step:1; }
public bool HasMark { get => _haveMark;}
public Liner()
{
_speed = 1;
_weight = 1;
_firstCol = Color.Magenta;
_secondCol = Color.Black;
_numOfBoxes = 6;
_haveMark = true;
try
{
_step = _speed / _weight;
}catch(Exception e) { throw new Exception("Дурашка, какой ноль в весе?"); }
}
///
///
///
///
/// (0,int.MaxValue]
///
///
/// [2,6]
///
public Liner(int speed, int weight, Color firstCol, Color secondCol, int numOfBoxes,bool haveMark)
{
if (numOfBoxes > 24||numOfBoxes<2)
throw new ArgumentOutOfRangeException($"{nameof(numOfBoxes)} out of range [2,24]");
_speed = speed;
_weight = weight;
_firstCol = firstCol;
_secondCol = secondCol;
_numOfBoxes = numOfBoxes;
_haveMark = haveMark;
try
{
_step = _speed / _weight;
}
catch (Exception e) { throw new Exception("Дурашка, какой ноль в весе?"); }
}
///
///
///
///
/// (0,int.MaxValue]
///
public Liner(int speed, int weight, Color firstCol)
{
_speed = speed;
_weight = weight;
_firstCol = firstCol;
_numOfBoxes = 6;
try
{
_step = _speed / _weight;
}
catch (Exception e) { throw e; }
}
}
}