public void CheckpointTriggered(CarController car, int checkPointIndex) { PositionData carData = _carPositions[car]; if (!_finished) { if (checkPointIndex == 0) { if (carData.checkPoint == checkpointcount-1) { carData.checkPoint = checkPointIndex; carData.lap += 1; Debug.Log(car.name + " lap " + carData.lap); if (IsPlayer(car)) { GetComponent<RaceManager>().Announce("Tour " + (carData.lap+1).ToString()); } if (carData.lap >= _totalLaps) { _finished = true; GetComponent<RaceManager>().EndRace(car.name.ToLower()); } } } else if (carData.checkPoint == checkPointIndex-1) //Checkpoints must be hit in order { carData.checkPoint = checkPointIndex; } } }
void Start() { engineSource = GetComponents<AudioSource>()[0]; skidSource = GetComponents<AudioSource>()[1]; car = GetComponent (typeof (CarController)) as CarController; drivetrain = GetComponent (typeof (Drivetrain)) as Drivetrain; }
public void SetCar(GameObject Car) { print("setcar "+Car); CurrentCar = Car; CC = Car.GetComponent<CarController>(); CarPos = Car.transform.position; }
bool IsPlayer(CarController car) { if (car == null) return false; return car.GetComponent<CarUserControlMP>() != null; }
// ========================================== // == Awake // ========================================== void Awake() { // get the car controller car = GetComponent<CarController>(); styleManager = GetComponent<StyleManager>(); }
public void Index_GetCar() { var expectedResult = new[] { new CarModel { CarId = 1, Name = "Foo", Color = "FooColor", Price = 11111, InventoryCount = 1, Manufacturer = new ManufacturerModel { ManufacturerId = 1, Country = "FooCountry", Name = "FooManu" } } }; var mockService = new Mock<ICarService>(MockBehavior.Strict); mockService.Setup(s => s.GetCar(expectedResult[0].CarId)).Returns(expectedResult[0]); var mockMapper = new Mock<Mappers.IMapper>(MockBehavior.Strict); mockMapper.Setup(m => m.Map(expectedResult, typeof(IEnumerable<CarModel>), typeof(IEnumerable<CarViewModel>))); var controller = new CarController(mockService.Object, mockMapper.Object); var result = controller.Index(false, expectedResult[0].CarId) as ViewResult; var model = result.Model as CarModel[]; Assert.IsNotNull(model); mockService.Verify(foo => foo.GetCar(expectedResult[0].CarId)); }
void Start() { car = GetComponent<CarController>(); transform.position = CurveFollower.transform.position; transform.rotation = CurveFollower.transform.rotation; CurveFollower.Speed = 0f; }
private void Awake() { // get the car controller m_Car = GetComponent<CarController>(); screenWidth = Screen.width; m_Rigidbody = GetComponent<Rigidbody>(); }
public RealCar(CarController parent) { Controller = parent; CarInfo = new CarInformations(); IsAlertBrakeActive = false; //regulators and communicator initiation CarComunicator = new RealCarCommunicator(this); // = new RealCarCommunicator(this); SpeedRegulator = new PIDSpeedRegulator(this); //SpeedRegulator = new FakeSpeedRegulator(); //SteeringWheelAngleRegulator = new SimpleSteeringWheelRegulator(this); SteeringWheelAngleRegulator = new PIDSteeringWheelAngleRegulator(this); //SteeringWheelAngleRegulator = new FakeSteeringWheelRegulator(); BrakeRegulator = new PIDBrakeRegulator(this); CarComunicator.InitRegulatorsEventsHandling(); //TODO: REFACTOR THIS SHIT!!! //for now this is needed, because reagulators does not exists when communicator constructor is invoked //internal event handling initialization evAlertBrake += new EventHandler(ExampleFakeCar_evAlertBrake); evTargetSpeedChanged += new TargetSpeedChangedEventHandler(ExampleFakeCar_evTargetSpeedChanged); evTargetSteeringWheelAngleChanged += new TargetSteeringWheelAngleChangedEventHandler(ExampleFakeCar_evTargetSteeringWheelAngleChanged); }
// Use this for initialization void OnEnable() { previousGear = 1; if(carController == null) carController = transform.root.GetComponent<CarController>(); carController.gearShiftEvent += OnGearShift; }
void Start() { engineSource = CreateAudioSource(engine); skidSource = CreateAudioSource(skid); car = GetComponent (typeof (CarController)) as CarController; drivetrain = GetComponent (typeof (Drivetrain)) as Drivetrain; }
void Awake() { _CarInfo = transform.root.GetComponent<CarInfo>(); _Car = transform.root.GetComponent<CarController>(); _Collider = GetComponent<Collider>(); Counting(); }
void Awake() { // get the car controller renderer.enabled = false; car = transform.parent.gameObject.GetComponent<CarController>(); rigidbody.position = car.rigidbody.position + Vector3.up * 5; }
void Start() { mTransform = transform; position = mTransform.position; rotation = mTransform.eulerAngles; car = CarController.instance; }
void Init() { _Sphere = GetComponent<SphereCollider>(); _ShootingScript = GetComponent<ShootScript>(); if (this.CompareTag("PlayerLogic")) { _PlayerCar = CarUserControl.Instance.m_Car; } else { _PlayerCar = GetComponent<CarController>(); } if (_Weapons.Length != 0) { for (int i = 0; i < _Weapons.Length; i++) { _Weapons[i]._HitBox = _Weapons[i]._WeaponCollider.GetComponent<HitBox>(); _Weapons[i]._Tower._HitBox = _Weapons[i]._Tower._TowerCollider.GetComponent<HitBox>(); _Weapons[i]._WeaponTransform = transform.SearchChildWithName(_Weapons[i]._Name); _Weapons[i]._Tower._TowerTransform = transform.SearchChildWithName(_Weapons[i]._Tower._Name); } } _ShootingScript.Init(); }
void Awake() { stuckTimerCount = 0; city = GameObject.FindObjectOfType<CityManager>(); controller = GetComponent<CarController> (); player = GameObject.FindGameObjectWithTag("Player").transform; GetComponentInChildren<UnityStandardAssets.Vehicles.Car.CarAIControl>().SetTarget(player); }
void Start() { carController = GameObject.Find("MB300SL").GetComponent<CarController>(); scroll = GetComponentInChildren<Scrollbar>(); txt1 = GameObject.Find("Text_LeftRMP").GetComponent<Text>(); txt2 = GameObject.Find("Text_RightRMP").GetComponent<Text>(); but_rest = GameObject.Find("Restart").GetComponent<Button>(); }
void Awake() { // get the car controller car = GetComponent<CarController>(); nitroBar.maxValue = 100; nitroBar.minValue = 0; nitroBar.value = 0; }
float avoidPathOffset; // direction (-1 or 1) in which to offset path to avoid other car, whilst avoiding void Awake () { // get the car controller reference carController = GetComponent<CarController>(); // give the random perlin a random value randomPerlin = Random.value*100; }
// Use this for initialization void Start() { /*if (cameraType == cameraTypes.terceiraPessoa) { transform.SetParent(mainCar.transform); }*/ mainCarController = mainCar.GetComponent<CarController> (); cameraIniPos = Camera.main.transform.localPosition; }
//Anarchy script; // Use this for initialization void Start() { carusercontrol = GetComponent<CarUserControl> (); carcontroller = GetComponent<CarController> (); carselfrighting = GetComponent<CarSelfRighting> (); objectresetter = GetComponent<ObjectResetter> (); //script = GetComponent<Anarchy> (); }
// Use this for initialization void Start() { shakeFX = GetComponent<ShakeEffect>(); shakeFX.loop = true; carController = transform.root.GetComponent<CarController>(); initialPos = transform.localPosition; cam = GetComponent<Camera>(); }
void Awake() { // get the car controller car = GetComponent<CarController>(); jumpScript = GetComponent<JumpScript>(); nitroScript = GetComponent<NitroScript>(); speedMeterScript = GetComponent<SpeedMeterScript>(); pathIndicatorScript = GetComponent<PathIndicatorScript>(); respawnScript = GetComponent<RespawnScript>(); }
public override void Update(CarController car) { Debug.DrawLine(car.transform.position, car.transform.position + car.Heading * car.stopDistance, Color.red); car.CheckForOtherCars(); if (car.CollisionIsPossible) { car.StopCar (); } else { car.Engine.UpdateCarPhysics (); } }
void Start() { car = transform.root.GetComponent<CarController>(); engineAudio = (AudioSource)GetComponent(typeof(AudioSource)); if (engineAudio == null) { Debug.Log("No audio source, please add one engine noise to the car"); } car.gearShiftEvent += OnGearShift; }
private void Awake() { // get the car controller reference m_CarController = GetComponent<CarController>(); // give the random perlin a random value m_RandomPerlin = Random.value*100; m_Rigidbody = GetComponent<Rigidbody>(); }
void Start() { car = transform.root.GetComponent<CarController>(); material = GetComponent<Renderer>().material; crashAudio = (AudioSource)GetComponent(typeof(AudioSource)); if (crashAudio == null) { Debug.Log("No audio source, please add one crash sound to the car"); } }
public void LapFinishedByAI(CarController car) { for(int i=0; i < scripts.Length; i++) { if(scripts[i] == car) { laps[i]++; break; } } }
void Start() { carController = gameObject.GetComponent<CarController>(); _audio = GetComponent<AudioSource>(); _audio.clip = startup; _audio.pitch = 0.5f; _audio.Play(); timer_start = startup.length; }
void Awake() { // get the car controller car = GetComponent<CarController> (); OuyaSDK.registerMenuButtonUpListener (this); OuyaSDK.registerMenuAppearingListener (this); OuyaSDK.registerPauseListener (this); OuyaSDK.registerResumeListener (this); Input.ResetInputAxes (); }
// Method that updates the car postition and fitness. If a something happens that should stop the simulation, // false is returned, else true. public bool UpdateCar(float deltaTime, bool doNotStopAtCrash, float maxTime) { if (!threaded && GetPosition() == 1) { leader = this; } totalTime += deltaTime; if (totalTime > maxTime) { return(false); } // If the current neural network is misformed stop simulation if (aIPlayer != null && !CalculateNetworkOutput(deltaTime) && !doNotStopAtCrash) { return(false); } if (aIPlayer == null) { GetInputs(); } // Move the car Move(deltaTime); // If the car has a collision if (OnGrass() > 3 || ((velocity.x == 0 && velocity.z == 0) && aIPlayer != null)) { // If the car has to stop at a crash stop the simulation if (threaded && !doNotStopAtCrash) { fitnessTracker.UpdateFitness(deltaTime, true, position); //trackSphere.GetComponent<Renderer>().material.color = Color.red; //trackSphere.transform.position = trackSphere.transform.position - new Vector3(0, 1, 0); acc = 0; return(false); } // Else reset the car and add a crash to the fitnessTracker if (!threaded) { Reset(true, true); fitnessTracker.AddCrash(); } else { ThreadReset(true, true); fitnessTracker.AddCrash(); if (fitnessTracker.crashes > 3) { return(false); } } } // Update the fitness tracker, checks if the number of laps has been completed and if so, stops the simulation if (!fitnessTracker.UpdateFitness(deltaTime, !doNotStopAtCrash, position)) { acc = 0; return(false); } // If everything went well let simulation continue return(true); }
private void OnCarDied(CarController car) { // Debug.Log("Dead"); // Switch to next best active }
void Start() { _source = GetComponent <AudioSource>(); _vehicle = GetComponent <CarController>(); }
private void Awake() { Car = GetComponent <CarController>(); }
public RaceCar(CarController car = null, uint checkpointIndex = 1) { this.Car = car; this.CheckpointIndex = checkpointIndex; }
void Start() { gameManager = FindObjectOfType <GameManager>(); carController = FindObjectOfType <CarController>(); }
public void TimeAttackModeStartButton() { CarController.GameMode(2); GameDirector.GameMode(2); SceneManager.LoadScene("GamePlayScene"); }
void Start() { carController = this.GetComponent <CarController>(); mc = mainController.GetComponent <MainController>(); }
private void FillDGV() { var v = new CarController(); dgvCar.DataSource = v.GetAll(); }
public void SetTarget(CarController playerCar) { topDownCam.target = playerCar; FollowCamera.m_Follow = playerCar.transform; FollowCamera.m_LookAt = playerCar.transform; }
public bool isKeyboardControlled = true; //true means only single person, false means split screen void Awake() { // get the car controller car = GetComponent <CarController>(); }
public void SetController(string strcontroller) { axisCarController = GetComponent <AxisCarController>(); // to make this function works with SaveSetup() mouseCarcontroller = GetComponent <MouseCarController>(); // to make this function works with SaveSetup() mobileCarController = GetComponent <MobileCarController>(); // to make this function works with SaveSetup() if (strcontroller == Controller.axis.ToString()) { if (axisCarController == null) { axisCarController = transform.gameObject.AddComponent <AxisCarController>(); } axisCarController.enabled = true; carController = axisCarController; if (drivetrain != null) { drivetrain.carController = axisCarController; } if (brakeLights != null) { brakeLights.carController = axisCarController; } if (dashBoard != null) { dashBoard.carController = axisCarController; } if (steeringWheel != null) { steeringWheel.carController = axisCarController; } if (soundController != null) { soundController.carController = axisCarController; } if (mouseCarcontroller != null) { mouseCarcontroller.enabled = false; } if (mobileCarController != null) { mobileCarController.enabled = false; } controller = Controller.axis; } else if (strcontroller == Controller.mouse.ToString()) { if (mouseCarcontroller == null) { mouseCarcontroller = transform.gameObject.AddComponent <MouseCarController>(); } mouseCarcontroller.enabled = true; mouseCarcontroller.smoothInput = false; carController = mouseCarcontroller; if (drivetrain != null) { drivetrain.carController = mouseCarcontroller; } if (brakeLights != null) { brakeLights.carController = mouseCarcontroller; } if (dashBoard != null) { dashBoard.carController = mouseCarcontroller; } if (steeringWheel != null) { steeringWheel.carController = mouseCarcontroller; } if (soundController != null) { soundController.carController = mouseCarcontroller; } if (axisCarController != null) { axisCarController.enabled = false; } if (mobileCarController != null) { mobileCarController.enabled = false; } controller = Controller.mouse; } else if (strcontroller == Controller.mobile.ToString()) { if (mobileCarController == null) { mobileCarController = transform.gameObject.AddComponent <MobileCarController>(); } mobileCarController.enabled = true; carController = mobileCarController; if (drivetrain != null) { drivetrain.carController = mobileCarController; } if (brakeLights != null) { brakeLights.carController = mobileCarController; } if (dashBoard != null) { dashBoard.carController = mobileCarController; } if (steeringWheel != null) { steeringWheel.carController = mobileCarController; } if (soundController != null) { soundController.carController = mobileCarController; } if (axisCarController != null) { axisCarController.enabled = false; } if (mouseCarcontroller != null) { mouseCarcontroller.enabled = false; } controller = Controller.mobile; } else if (strcontroller == Controller.external.ToString()) { if (mouseCarcontroller != null) { mouseCarcontroller.throttle = drivetrain.throttle = 0; mouseCarcontroller.enabled = false; } if (axisCarController != null) { axisCarController.throttle = drivetrain.throttle = 0; axisCarController.enabled = false; } if (mobileCarController != null) { mobileCarController.throttle = drivetrain.throttle = 0; mobileCarController.enabled = false; } controller = Controller.external; } }
private void Awake() { carManager = GetComponent <CarManager>(); carController = GetComponent <CarController>(); }
void Start() { carController = GetComponent <CarController> (); _audioSource = GetComponent <AudioSource> (); }
private void Awake() { this.carController = base.GetComponent <CarController>(); this.randomPerlin = UnityEngine.Random.value * 100f; }
private IEnumerator LetCarGo(CarController car, float time) { yield return(new WaitForSeconds(time / 2)); car.SetAccelerating(true); }
void Start() { player = FindObjectOfType <CarController>(); generateChunk(); }
void Awake() { controller = GetComponent <CarController>(); }
public EvasiveManoeuvres(AIControls ai, CarController car) : base(ai, car) { // TODO: listen for powerup spawn }
void Awake() { trackManager = GetComponent <CarTrackController>(); carController = GetComponent <CarController>(); }
public void JustStopModeStartButton() { CarController.GameMode(1); GameDirector.GameMode(1); SceneManager.LoadScene("GamePlayScene"); }
void Start() { car = transform.parent.gameObject; carController = car.GetComponent <CarController>(); exhaust = GetComponent <ParticleSystem>(); }
public ExplosionState(CarController carController, float explodingTime) : base(carController, 0, 0) { this.explodingTime = explodingTime; }
public CarApiController(CarController carController) { _carController = carController; }
/// <summary> /// Sets the CarController from which to get the data from to be displayed. /// </summary> /// <param name="target">The CarController to display the data of.</param> public void SetDisplayTarget(CarController target) { simulationUI.Target = target; }
void UpdateCarCreatorBefore1_4() { #region if (GUILayout.Button("Update Car created before version 1.4")) { CarController myScript = (CarController)target; //-> Add new Impact script if (!Selection.activeGameObject.GetComponent <impact>()) { Undo.AddComponent(Selection.activeGameObject, typeof(impact)); } // -> Add an audiosource + Select the impact sound if (!Selection.activeGameObject.GetComponent <AudioSource>()) { Undo.AddComponent(Selection.activeGameObject, typeof(AudioSource)); string objectPath = "Assets/MCR Creator/Assets/Audios/Engine/Impact_03.wav"; AudioClip _AudioClip = AssetDatabase.LoadAssetAtPath(objectPath, typeof(UnityEngine.Object)) as AudioClip; Selection.activeGameObject.GetComponent <AudioSource>().clip = _AudioClip; Selection.activeGameObject.GetComponent <AudioSource>().playOnAwake = false; } //-> Add script MCR_Skid if (!Selection.activeGameObject.GetComponent <MCR_Skid>()) { Undo.AddComponent(Selection.activeGameObject, typeof(MCR_Skid)); string objectPath = "Assets/MCR Creator/Assets/Prefabs/04_Other/Trail_SkidMarks.prefab"; GameObject _Trail = AssetDatabase.LoadAssetAtPath(objectPath, typeof(UnityEngine.Object)) as GameObject; Selection.activeGameObject.GetComponent <MCR_Skid>().ObjTrail = _Trail; } // -> Add Prefab Front_Ray_SlowCar | Cube_RL | Cube_RL Transform[] children = myScript.GetComponentsInChildren <Transform>(true); foreach (Transform child in children) { if (child.name == "Capsule_Front") { string objectPath = "Assets/MCR Creator/Assets/Prefabs/04_Other/CarUpdate/Front_Ray_SlowCar.prefab"; GameObject Front_Ray_SlowCar = Instantiate(AssetDatabase.LoadAssetAtPath(objectPath, typeof(UnityEngine.Object)) as GameObject, child); Front_Ray_SlowCar.transform.localScale = new Vector3(0.025f, 0.025f, 0.025f); Front_Ray_SlowCar.transform.localPosition = new Vector3(.0011f, -0.0403f, 0.122f); Undo.RegisterCreatedObjectUndo(Front_Ray_SlowCar, "Front_Ray_SlowCar"); } if (child.name == "Grp_Wheel_RL") { string objectPath = "Assets/MCR Creator/Assets/Prefabs/04_Other/CarUpdate/Cube_RL.prefab"; GameObject Cube_RL = Instantiate(AssetDatabase.LoadAssetAtPath(objectPath, typeof(UnityEngine.Object)) as GameObject, child); Cube_RL.transform.localScale = new Vector3(0.025f, 0.025f, 0.025f); Cube_RL.transform.localPosition = new Vector3(.001f, -0.0159f, -0.102f); Undo.RegisterCreatedObjectUndo(Cube_RL, "Cube_RL"); } if (child.name == "Grp_Wheel_RR") { string objectPath = "Assets/MCR Creator/Assets/Prefabs/04_Other/CarUpdate/Cube_RR.prefab"; GameObject Cube_RR = Instantiate(AssetDatabase.LoadAssetAtPath(objectPath, typeof(UnityEngine.Object)) as GameObject, child); Cube_RR.transform.localScale = new Vector3(0.025f, 0.025f, 0.025f); Cube_RR.transform.localPosition = new Vector3(-.008f, -0.0159f, -0.102f); Undo.RegisterCreatedObjectUndo(Cube_RR, "Cube_RR"); } } } #endregion }
public override void OnInspectorGUI() { if (SeeInspector.boolValue) // If true Default Inspector is drawn on screen { DrawDefaultInspector(); } serializedObject.Update(); GUILayout.Label(""); EditorGUILayout.BeginHorizontal(); GUILayout.Label("Inspector :", GUILayout.Width(90)); EditorGUILayout.PropertyField(SeeInspector, new GUIContent(""), GUILayout.Width(30)); EditorGUILayout.EndHorizontal(); // CarController myScript = (CarController)target; //GUIStyle style = new GUIStyle(GUI.skin.box); GUIStyle style_Yellow_01 = new GUIStyle(GUI.skin.box); style_Yellow_01.normal.background = Tex_01; GUIStyle style_Blue = new GUIStyle(GUI.skin.box); style_Blue.normal.background = Tex_04; GUIStyle style_Purple = new GUIStyle(GUI.skin.box); style_Purple.normal.background = Tex_03; GUIStyle style_Orange = new GUIStyle(GUI.skin.box); style_Orange.normal.background = Tex_05; GUIStyle style_Yellow_Strong = new GUIStyle(GUI.skin.box); style_Yellow_Strong.normal.background = Tex_02; GUILayout.Label(""); EditorGUILayout.BeginVertical(style_Yellow_01); EditorGUILayout.HelpBox("Global Presets", MessageType.Info); EditorGUILayout.BeginHorizontal(); // --> Use preset for Desktop or Mobile if (GUILayout.Button("Default Values")) { Undo.RegisterCompleteObjectUndo(myScript, "All Property Modif " + myScript.gameObject.name); SpringHeight.floatValue = .164F; PicWheelSize.floatValue = .265F; WheelSizeRear.floatValue = 0F; WheelSizeFront.floatValue = 0F; damperConstant.floatValue = 10F; springConstant.floatValue = 300F; RearWheelsDistance.floatValue = .084F; FrontWheelsDistance.floatValue = .084F; LenghtWheelsDistance.floatValue = .127F; com.FindPropertyRelative("z").floatValue = -.0119F; SerializedObject serializedObject0 = new UnityEditor.SerializedObject(myScript.CarBodyCollider.GetComponent <Transform>()); serializedObject0.Update(); SerializedProperty m_LocalBodyColliderPos = serializedObject0.FindProperty("m_LocalPosition"); SerializedProperty m_LocalBodyColliderSc = serializedObject0.FindProperty("m_LocalScale"); m_LocalBodyColliderPos.vector3Value = new Vector3(0, 0, 0); m_LocalBodyColliderSc.vector3Value = new Vector3(.78F, 1.06F, 1); serializedObject0.ApplyModifiedProperties(); MaxSpeed.floatValue = 4.2F; CarRotationSpeed.floatValue = 3.2F; impactVolumeMax.floatValue = .3F; eulerAngleVelocity.FindPropertyRelative("y").floatValue = 100F; } /*if(GUILayout.Button("Default Mobile Values")) * { * Undo.RegisterCompleteObjectUndo(myScript,"All Property Modif " + myScript.gameObject.name); * SpringHeight.floatValue = .11F; * PicWheelSize.floatValue = .19F; * WheelSizeRear.floatValue = 0F; * WheelSizeFront.floatValue = 0F; * * damperConstant.floatValue = 15F; * springConstant.floatValue = 500F; * RearWheelsDistance.floatValue = .07F; * FrontWheelsDistance.floatValue = .07F; * LenghtWheelsDistance.floatValue = .127F; * com.FindPropertyRelative("z").floatValue = -.01F; * * SerializedObject serializedObject0 = new UnityEditor.SerializedObject(myScript.CarBodyCollider.GetComponent<Transform>()); * serializedObject0.Update(); * SerializedProperty m_LocalBodyColliderPos = serializedObject0.FindProperty("m_LocalPosition"); * SerializedProperty m_LocalBodyColliderSc = serializedObject0.FindProperty("m_LocalScale"); * * m_LocalBodyColliderPos.vector3Value = new Vector3(0,0,0); * m_LocalBodyColliderSc.vector3Value = new Vector3(.78F,1.06F,1); * serializedObject0.ApplyModifiedProperties (); * * MaxSpeed.floatValue = 3.98F; * CarRotationSpeed.floatValue = 1.5F; * * impactVolumeMax.floatValue = .3F; * * eulerAngleVelocity.FindPropertyRelative("y").floatValue = 100F; * }*/ EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); // --> Display player number EditorGUILayout.BeginVertical(style_Yellow_01); EditorGUILayout.HelpBox("Infos", MessageType.Info); EditorGUILayout.BeginHorizontal(); GUILayout.Label("Player Number : ", GUILayout.Width(100)); EditorGUILayout.PropertyField(playerNumber, new GUIContent("")); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); // --> Car handling EditorGUILayout.LabelField(""); EditorGUILayout.BeginVertical(style_Blue); EditorGUILayout.HelpBox("Car handling", MessageType.Info); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Max Speed :", GUILayout.Width(145)); EditorGUILayout.Slider(MaxSpeed, 1.5F, 6F, new GUIContent("")); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Wheel steering reactivity", GUILayout.Width(145)); EditorGUILayout.Slider(CarRotationSpeed, 1F, 7F, new GUIContent("")); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Car Rotation Speed :", GUILayout.Width(145)); EditorGUILayout.Slider(eulerAngleVelocity.FindPropertyRelative("y"), 50F, 150F, new GUIContent("")); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); EditorGUILayout.LabelField(""); // --> Section Spring Height EditorGUILayout.BeginVertical(style_Purple); EditorGUILayout.HelpBox("Springs Options", MessageType.Info); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Spring Height :", GUILayout.Width(145)); EditorGUILayout.Slider(SpringHeight, .11F, .3F, new GUIContent("")); EditorGUILayout.EndHorizontal(); EditorGUILayout.LabelField(""); // --> Section Damper Stiffness EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Damper :", GUILayout.Width(145)); EditorGUILayout.Slider(damperConstant, 3F, 15F, new GUIContent("")); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Spring Stiffness :", GUILayout.Width(145)); EditorGUILayout.Slider(springConstant, 300, 500, new GUIContent("")); EditorGUILayout.EndHorizontal(); EditorGUILayout.LabelField(""); EditorGUILayout.EndVertical(); EditorGUILayout.LabelField(""); // --> Section Wheels options EditorGUILayout.BeginVertical(style_Orange); EditorGUILayout.HelpBox("Wheels Options", MessageType.Info); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Rear Wheels Distance :", GUILayout.Width(145)); EditorGUILayout.Slider(RearWheelsDistance, 0F, .2F, new GUIContent("")); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Front Wheels Distance :", GUILayout.Width(145)); EditorGUILayout.Slider(FrontWheelsDistance, 0F, .2F, new GUIContent("")); EditorGUILayout.EndHorizontal(); EditorGUILayout.LabelField(""); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Length Wheels Distance :", GUILayout.Width(145)); EditorGUILayout.Slider(LenghtWheelsDistance, 0F, .4F, new GUIContent("")); EditorGUILayout.EndHorizontal(); restLength.floatValue = SpringHeight.floatValue + .01F; dis.floatValue = SpringHeight.floatValue; float percentagespringConstant = (springConstant.floatValue - 300) / (500 - 300); if (!Application.isPlaying) { for (int i = 0; i < myScript.Wheel_X_Rotate.Length; i++) { if (i == 0 || i == 1) { myScript.Wheel_X_Rotate[i].transform.localPosition = new Vector3( 0, -SpringHeight.floatValue + .065F + offsetWheelFront.floatValue + .0F * (1 - percentagespringConstant), // Total .11F Minimum Spring Height 0); } else { myScript.Wheel_X_Rotate[i].transform.localPosition = new Vector3( 0, -SpringHeight.floatValue + .065F + offsetWheelRear.floatValue + .0F * (1 - percentagespringConstant), // Total .11F Minimum Spring Height 0); } myScript.pivotCarSelection.transform.localPosition = new Vector3( 0, -SpringHeight.floatValue + offsetWheelFront.floatValue + .0F * (1 - percentagespringConstant), // Total .11F Minimum Spring Height 0); } } EditorGUILayout.LabelField(""); // --> Section Wheel Size EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Global Wheel Size :", GUILayout.Width(145)); EditorGUILayout.Slider(PicWheelSize, .05F, .5F, new GUIContent("")); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Rear Wheel Size :", GUILayout.Width(145)); EditorGUILayout.Slider(WheelSizeRear, 0, .5F, new GUIContent("")); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Front Wheel Size :", GUILayout.Width(145)); EditorGUILayout.Slider(WheelSizeFront, 0, .5F, new GUIContent("")); EditorGUILayout.EndHorizontal(); for (int i = 0; i < myScript.Wheel_X_Rotate.Length; i++) { if (i == 2 || i == 3) { myScript.Wheel_X_Rotate[i].transform.localScale = new Vector3( PicWheelSize.floatValue + WheelSizeRear.floatValue, PicWheelSize.floatValue + WheelSizeRear.floatValue, PicWheelSize.floatValue + WheelSizeRear.floatValue); } else { myScript.Wheel_X_Rotate[i].transform.localScale = new Vector3( PicWheelSize.floatValue + WheelSizeFront.floatValue, PicWheelSize.floatValue + WheelSizeFront.floatValue, PicWheelSize.floatValue + WheelSizeFront.floatValue); } myScript.pivotCarSelection.transform.localPosition = new Vector3( // Move the pivotCarSelection gameobject 0, -SpringHeight.floatValue + .035F, // 0 + pivotOffsetZ.floatValue); } //float percentageWheelSize = (PicWheelSize.floatValue - .05F) / (.5F - .05F); float percentageWheelSize = ((PicWheelSize.floatValue + WheelSizeRear.floatValue) - .05F) / (.5F - .05F); offsetWheelRear.floatValue = (percentageWheelSize * (.11F - .018F)) + .018F; percentageWheelSize = ((PicWheelSize.floatValue + WheelSizeFront.floatValue) - .05F) / (.5F - .05F); offsetWheelFront.floatValue = (percentageWheelSize * (.11F - .018F)) + .018F; EditorGUILayout.EndVertical(); EditorGUILayout.LabelField(""); EditorGUILayout.BeginVertical(style_Yellow_Strong); EditorGUILayout.HelpBox("Car Body Options", MessageType.Info); // --> Update the Front Wheel capsule collider size SerializedObject serializedObject2 = new UnityEditor.SerializedObject(myScript.frontCapsuleCollider.GetComponent <CapsuleCollider>()); serializedObject2.Update(); SerializedProperty m_Height_frontCapsuleCollider = serializedObject2.FindProperty("m_Height"); float tmpFloat = (FrontWheelsDistance.floatValue - 0) / (.2F - 0) * .44F; m_Height_frontCapsuleCollider.floatValue = tmpFloat; serializedObject2.ApplyModifiedProperties(); SerializedObject serializedObject6 = new UnityEditor.SerializedObject(myScript.frontCapsuleCollider.GetComponent <Transform>()); serializedObject6.Update(); SerializedProperty m_Distance_frontCapsuleCollider = serializedObject6.FindProperty("m_LocalPosition").FindPropertyRelative("z"); tmpFloat = LenghtWheelsDistance.floatValue; m_Distance_frontCapsuleCollider.floatValue = tmpFloat; serializedObject6.ApplyModifiedProperties(); // --> Update the Rear Wheel capsule collider size SerializedObject serializedObject3 = new UnityEditor.SerializedObject(myScript.rearCapsuleCollider.GetComponent <CapsuleCollider>()); serializedObject3.Update(); SerializedProperty m_Height_rearCapsuleCollider = serializedObject3.FindProperty("m_Height"); tmpFloat = (RearWheelsDistance.floatValue - 0) / (.2F - 0) * .44F; m_Height_rearCapsuleCollider.floatValue = tmpFloat; serializedObject3.ApplyModifiedProperties(); SerializedObject serializedObject5 = new UnityEditor.SerializedObject(myScript.rearCapsuleCollider.GetComponent <Transform>()); serializedObject5.Update(); SerializedProperty m_Distance_rearCapsuleCollider = serializedObject5.FindProperty("m_LocalPosition").FindPropertyRelative("z"); tmpFloat = -LenghtWheelsDistance.floatValue; m_Distance_rearCapsuleCollider.floatValue = tmpFloat; serializedObject5.ApplyModifiedProperties(); myScript.RayCastWheels[2].transform.localPosition = new Vector3( RearWheelsDistance.floatValue, myScript.RayCastWheels[2].transform.localPosition.y, -LenghtWheelsDistance.floatValue); myScript.RayCastWheels[3].transform.localPosition = new Vector3( -RearWheelsDistance.floatValue, myScript.RayCastWheels[3].transform.localPosition.y, -LenghtWheelsDistance.floatValue); myScript.RayCastWheels[0].transform.localPosition = new Vector3( FrontWheelsDistance.floatValue, myScript.RayCastWheels[0].transform.localPosition.y, LenghtWheelsDistance.floatValue); myScript.RayCastWheels[1].transform.localPosition = new Vector3( -FrontWheelsDistance.floatValue, myScript.RayCastWheels[1].transform.localPosition.y, LenghtWheelsDistance.floatValue); // --> Update the body Model position SerializedObject serializedObject10 = new UnityEditor.SerializedObject(myScript.Grp_BodyPlusBlobShadow.GetComponent <Transform>()); serializedObject10.Update(); SerializedProperty m_LocalBodyModelPosition = serializedObject10.FindProperty("m_LocalPosition"); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Body Model Z Position :", GUILayout.Width(145)); EditorGUILayout.Slider(m_LocalBodyModelPosition.FindPropertyRelative("z"), -.2F, .2F, new GUIContent("")); EditorGUILayout.EndHorizontal(); serializedObject10.ApplyModifiedProperties(); // --> Update the body collider position and scale SerializedObject serializedObject4 = new UnityEditor.SerializedObject(myScript.CarBodyCollider.GetComponent <Transform>()); serializedObject4.Update(); SerializedProperty m_LocalBodyColliderPosition = serializedObject4.FindProperty("m_LocalPosition"); SerializedProperty m_LocalBodyColliderScale = serializedObject4.FindProperty("m_LocalScale"); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Body Collider Position :", GUILayout.Width(145)); EditorGUILayout.Slider(m_LocalBodyColliderPosition.FindPropertyRelative("z"), -.2F, .2F, new GUIContent("")); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Body Collider Scale :", GUILayout.Width(145)); EditorGUILayout.PropertyField(m_LocalBodyColliderScale, new GUIContent("")); EditorGUILayout.EndHorizontal(); serializedObject4.ApplyModifiedProperties(); EditorGUILayout.LabelField(""); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Center Of Mass Z Axis :", GUILayout.Width(145)); EditorGUILayout.Slider(com.FindPropertyRelative("z"), -.06F, .06F, new GUIContent("")); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); EditorGUILayout.LabelField(""); // --> Update the pivot use for car selection position and scale EditorGUILayout.BeginVertical(style_Purple); EditorGUILayout.HelpBox("Offset for gameObject use as a pivot on Menu car selection", MessageType.Info); EditorGUILayout.LabelField(""); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Offset Z Axis :", GUILayout.Width(145)); EditorGUILayout.Slider(pivotOffsetZ, -.4F, .4F, new GUIContent("")); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); EditorGUILayout.LabelField(""); // --> Section Audio EditorGUILayout.BeginVertical(style_Blue); EditorGUILayout.HelpBox("Audio Options :" + "\n" + "\n- Drag and drop audio clip for each type of sound" + "\n- Change volume for each type of sound" + "\n", MessageType.Info); SerializedObject serializedObject7 = new UnityEditor.SerializedObject(myScript.audio_); serializedObject7.Update(); SerializedProperty m_AudioClip = serializedObject7.FindProperty("m_audioClip"); SerializedProperty m_Volume = serializedObject7.FindProperty("m_Volume"); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Acceleration :", GUILayout.Width(145)); EditorGUILayout.PropertyField(m_AudioClip, new GUIContent("")); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Volume :", GUILayout.Width(145)); EditorGUILayout.Slider(m_Volume, 0F, 1F, new GUIContent("")); EditorGUILayout.EndHorizontal(); serializedObject7.ApplyModifiedProperties(); EditorGUILayout.LabelField(""); SerializedObject serializedObject8 = new UnityEditor.SerializedObject(myScript.objSkid_Sound); serializedObject8.Update(); m_AudioClip = serializedObject8.FindProperty("m_audioClip"); m_Volume = serializedObject8.FindProperty("m_Volume"); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Skid :", GUILayout.Width(145)); EditorGUILayout.PropertyField(m_AudioClip, new GUIContent("")); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Volume :", GUILayout.Width(145)); EditorGUILayout.Slider(m_Volume, 0F, 1F, new GUIContent("")); EditorGUILayout.EndHorizontal(); serializedObject8.ApplyModifiedProperties(); EditorGUILayout.LabelField(""); SerializedObject serializedObject9 = new UnityEditor.SerializedObject(myScript.obj_CarImpact_Sound); serializedObject9.Update(); m_AudioClip = serializedObject9.FindProperty("m_audioClip"); m_Volume = serializedObject9.FindProperty("m_Volume"); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Impact :", GUILayout.Width(145)); EditorGUILayout.PropertyField(m_AudioClip, new GUIContent("")); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Volume :", GUILayout.Width(145)); EditorGUILayout.Slider(impactVolumeMax, 0F, 1F, new GUIContent("")); EditorGUILayout.EndHorizontal(); serializedObject9.ApplyModifiedProperties(); EditorGUILayout.LabelField(""); EditorGUILayout.EndVertical(); EditorGUILayout.LabelField(""); // --> Section Fake car rotationn left Right EditorGUILayout.BeginVertical(style_Orange); EditorGUILayout.HelpBox("Adjust the left right body car movement", MessageType.Info); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Rotation :", GUILayout.Width(145)); EditorGUILayout.Slider(BodyRotationValue, 0F, 10F, new GUIContent("")); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); EditorGUILayout.LabelField(""); // --> Section Update Car Created before version 1.4 UpdateCarCreatorBefore1_4(); EditorGUILayout.LabelField(""); serializedObject.ApplyModifiedProperties(); }
// Start is called before the first frame update void Start() { carController = GetComponent <CarController>(); }
void Start() { obj = GameObject.Find("Car").GetComponent <CarController>(); aa = GameObject.Find("Car").GetComponent <CarAIControl>(); }
public _TripsForm(ApplicationDbContext db) { _customerController = new CustomerController(db); _tripController = new TripController(db); _carController = new CarController(db); }