Exemple #1
0
        private void CarSelection()
        {
            //var p = new Point(UI.WIDTH / 2 - 150, UI.HEIGHT - 225);
            //new UIRectangle(new Point(p.X, p.Y + 25), new Size(300, 20), Color.FromArgb(180, 8, 8, 8)).Draw();
            //new UIText("Name: " + PlayerName, new Point(p.X + 150, p.Y + 25), 0.25f, Color.White, 0, true).Draw();
            //new UIText((CarModel != null && (CarModel.Model.IsCar || CarModel.Model.IsBike || CarModel.Model.IsBicycle || CarModel.Model.IsHelicopter || CarModel.Model.IsPlane || CarModel.Model.IsQuadbike)
            //    ? "Drivable" : "Not Driveable"), new Point(p.X + 150, p.Y - 5), 0.25f, Color.White, 0, true).Draw();
            //var name = "License Plate:" + CarPlate;
            //
            //new UIRectangle(new Point(p.X, p.Y + 50), new Size(300, 20), Color.FromArgb(180, 8, 8, 8)).Draw();
            //new UIText(name, new Point(p.X + 150, p.Y + 50), 0.25f, Color.White, 0, true).Draw();

            if (!IsOpen(CarSelectMenu))
            {
                if (CharacterModel != null) CharacterModel.Delete();
                View.AddMenu(CarSelectMenu);
            }

            if (CarModel == null)
            {
                var m = new Model(AvailableCars[CurrentCarModel]);
                m.Request(1000);
                CarModel = World.CreateVehicle(m, _carPosition, _carHeading);
                RPG.WorldData.AddVehicle(new VehicleObject("charCreation", CarModel));

                CarModel.PrimaryColor = AvailableColors[CurrentCarColor];
                CarModel.SecondaryColor = AvailableSecondaryColors[CurrentCarSecondaryColor];
                CarModel.NumberPlate = "";
                CarModel.NumberPlate = CarPlate;
                CarModel.RoofState = VehicleRoofState.Closed;
                Camera.Position = _camPosition + new Vector3(CarModel.Model.GetDimensions().Y, CarModel.Model.GetDimensions().Y/3, 0);
                if (CarModel != null && !(CarModel.Model.IsCar || CarModel.Model.IsBike || CarModel.Model.IsBicycle || CarModel.Model.IsHelicopter || CarModel.Model.IsPlane || CarModel.Model.IsQuadbike))
                {
                    CarModel.Delete();
                    CarModel = null;
                    NextModel();
                }

                if (CarModel != null)
                {
                    Camera.PointAt(CarModel);
                }
            }
            else
            {
                CarModel.FreezePosition = true;
                //CarModel.Rotation = new Vector3(CarModel.Rotation.X, CarModel.Rotation.Y, CarModel.Rotation.Z + 0.05f);
            }
        }