private void CarSpawned(TrainCar car)
        {
            if (_spawningCar)
            {
                return;
            }
            if (!MultiPlayerManager.Instance.IsMultiPlayer)
            {
                return;
            }

            Logger.LogInfo($"Spawned {car} at {car.transform.position - WorldMover.currentMove} moved by {WorldMover.currentMove}");

            if (car.GetComponent <LocoControllerShunter>())
            {
                car.gameObject.AddComponent <LocoStateShunterSync>().Init();
            }
            //else if (car.GetComponent<LocoControllerDiesel>()) car.gameObject.AddComponent<LocoStateDieselSync>().Init();
            //else if (car.GetComponent<LocoControllerSteam>()) car.gameObject.AddComponent<LocoStateSteamSync>().Init();
            //else if (car.GetComponent<LocoControllerHandcar>()) car.gameObject.AddComponent<LocoStateHandcarSync>().Init();
            else if (car.GetComponent <LocoControllerBase>())
            {
                CarSpawner.DeleteCar(car);
                return;
                //car.gameObject.AddComponent<LocoStateSync>().Init();
            }
            else
            {
                car.gameObject.AddComponent <TrainCarSync>().Init();
            }

            _ownedCars.Add(car);
            SendCarInformation(car, default);
            SendSetInformation(TrainSetSync.CreateLocal(car._trainset), default);
        }
        public bool Receive(TrainSetInformationPacket packet, ClientId client)
        {
            Logger.LogInfo($"Receive set: {string.Join(", ", packet.Cars)}");

            var cars = packet.Cars.Select(id => CarSpawner.Instance.allCars.FirstOrDefault(c => c.GetComponent <NetworkObject>().Id == id)).ToList();

            TrainSetSync.CreateRemote(cars, packet.Id);
            return(true);
        }
 private void SendSetInformation(TrainSetSync set, ClientId client)
 {
     NetworkManager.Send(set.Info(), client);
 }