Esempio n. 1
0
        public void Init() {
            // Update components list
            List<CollectedComponents> components = new List<CollectedComponents>();
            if(CollectedComponents != null && CollectedComponents.CollectedComponentsList != null)
                components = CollectedComponents.CollectedComponentsList;

            foreach(var v in Vehicles.VehicleModel) {
                if(v.UnlockCost < 0 && !components.Exists(e => e.VehicleId == v.IdVehicle)) {
                    components.Add(new CollectedComponents { VehicleId = v.IdVehicle, VehicleComponents = new Components() });
                }
            }

            if(CollectedComponents == null) {
                CollectedComponents = new CollectedComponentsContainer {
                    CollectedComponentsList = components
                };
            }
            else {
                var collected = CollectedComponents;
                collected.CollectedComponentsList = components;
                CollectedComponents = collected;
            }

            // TODO: update unlocked vehicles list
            var vehiclesOrig = UnlockedVehicles;
            foreach(var v in vehiclesOrig.VehicleModel) {
                var vehicleData = Vehicles.VehicleModel.First(m => m.IdVehicle == v.IdVehicle);
                vehiclesOrig.VehicleModel.First(m => m.IdVehicle == v.IdVehicle).UpdateVehicleModel(vehicleData);
            }
            UnlockedVehicles = vehiclesOrig;
        }
Esempio n. 2
0
        public string JoystickLayoutPatch;// => JoystickLayoutPatches.WithZoomInAndOut;

        //DebugHud _debug;
        protected override void Start()
        {
            InitResourceCache();

            InitUiInfo();

            InitLoadingScreen();

            Task.Run(async() => { await InitTracks(); }).Wait();

            LaunchScene(GameScenesEnumeration.MENU);

            JsonReaderVehicles.GetVehicleConfig();

            CharacterLevelData.PointsToNextLevel();

            VehicleManager.Instance.Init();

#if DEBUG
            // TEST DATA FOR BUYING VEHICLES

            CharacterManager.Instance.Wallet = 100000;

            var newComponentsContainer = new CollectedComponentsContainer {
                CollectedComponentsList = new List <CollectedComponents>()
            };
            var components = VehicleManager.Instance.CollectedComponents;
            foreach (var c in components.CollectedComponentsList)
            {
                var newComponents = new CollectedComponents {
                    VehicleId         = c.VehicleId,
                    VehicleComponents = new Components()
                };
                newComponents.VehicleComponents.Brakes      = true;
                newComponents.VehicleComponents.Performance = true;
                newComponents.VehicleComponents.Suspensions = true;
                newComponents.VehicleComponents.Wheels      = true;
                newComponentsContainer.CollectedComponentsList.Add(newComponents);
            }
            VehicleManager.Instance.CollectedComponents = newComponentsContainer;

            //_debug = Engine.CreateDebugHud();
            //_debug.ToggleAll();
#endif
        }