Пример #1
0
 public void AddTyre(Tyre tyre)
 {
     if (TyreCount >= StandardTyreCount) {
         throw new InvalidOperationException();
     }
     _tyres.Add(tyre);
 }
Пример #2
0
        Tyre[] CreateTyres(int number)
        {
            var tyres = new Tyre[number];

            for (int i = 0; i < tyres.Length; i++) {
                tyres[i] = new Tyre();
            }
            return tyres;
        }
Пример #3
0
        public Car(
			Engine engine,
			Tyre[] tyres
		)
        {
            LoadEngine (engine);
            if (tyres != null) {
                foreach (var item in tyres) {
                    AddTyre (item);
                }
            }
        }
Пример #4
0
        private void RepairTyre(Car car)
        {
            if (car.IsTyreBroken) {
                car.UnloadBrokenTyres();
                for(int i = car.TyreCount; i < Car.StandardTyreCount; i++)
                {
                    var tyre = new Tyre();

                    car.AddTyre(tyre);
                }
            }
        }