void ResetDeligate() { moveAllCars = null; showCarsInfo = null; prepairToStartAll = null; isfinishedCar = null; showCarsInfoEnd = null; winner = 1; GC.Collect(); }
/// <summary> /// констуктор по умолчанию, запрос количества машин в меню /// </summary> public Races() { car = new List <Car>(); moveAllCars = null; showCarsInfo = null; prepairToStartAll = null; isfinishedCar = null; showCarsInfoEnd = null; winner = 1; }
void Prepair() { foreach (var item in car) { ///формирую массив методов в делегат moveAllCars += item.MoveCar; showCarsInfo += item.ShowCarInfo; showCarsInfoEnd += item.ShowWhenEndPoint; prepairToStartAll += item.PrepearToStart; isfinishedCar += item.CheckFInished; ///подписки на начало игры, движение машины, и финиш и изменение скорости item.Inicilization += Item_Inicilization; item.MoveShowEvent += Item_MoveShowEvent; item.Onfinish += Item_Onfinish; item.ChangeSpeed += Item_ChangeSpeed; } }