private void checkTurboCondition() { // Written, 27.10.2020 this.turboBlades.transform.localEulerAngles += new Vector3(10, 0f, 0f); ModClient.guiInteract("Looks alright"); MasterAudio.PlaySound3DAndForget("Motor", this.transform, false, 1, null, 0f, "valve_knock"); }
void Update() { // Written, 28.10.2020 if (!this.transform.parent.gameObject.isPlayerHolding()) { if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out RaycastHit hit, 1f, 1 << this.gameObject.layer)) { if (hit.collider.gameObject == this.gameObject) { this.previousWastegateHit = true; ModClient.guiInteract("Wastegate:" + (this.turboSimulation?.wastegatePsi ?? this.wastegatePsiToAdd).ToString("0.##") + "PSI"); if (Input.mouseScrollDelta.y > 0) { if ((this.turboSimulation?.wastegatePsi ?? this.wastegatePsiToAdd) < this.wastegateMaxPsi) { if (this.turboSimulation == null) { this.wastegatePsiToAdd += this.wastegatePsiIncrease; } else { this.turboSimulation.addWastegatePsi(this.wastegatePsiIncrease); } MasterAudio.PlaySound3DAndForget("CarBuilding", this.gameObject.transform, false, 1f, null, 0f, "bolt_screw"); } } else if (Input.mouseScrollDelta.y < 0) { if ((this.turboSimulation?.wastegatePsi ?? this.wastegatePsiToAdd) > this.wastegateMinPsi) { if (this.turboSimulation == null) { this.wastegatePsiToAdd -= this.wastegatePsiIncrease; } else { this.turboSimulation.addWastegatePsi(-this.wastegatePsiIncrease); } MasterAudio.PlaySound3DAndForget("CarBuilding", this.gameObject.transform, false, 1f, null, 0f, "bolt_screw"); } } } } } else if (this.previousWastegateHit) { ModClient.guiInteract(inGuiInteractSymbol: GuiInteractSymbolEnum.None); this.previousWastegateHit = false; } }
void Update() { // Written, 27.10.2020 RaycastHit hit; if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 1f, 1 << this.turboBlades.layer)) { ModClient.guiUse = hit.collider?.gameObject == this.turboBlades; if (ModClient.guiUse) { this.previousTurboBladesHit = true; if (cInput.GetButtonDown("Use")) { this.checkTurboCondition(); } } } else if (this.previousTurboBladesHit) { this.previousTurboBladesHit = false; ModClient.guiInteract(inGuiInteractSymbol: GuiInteractSymbolEnum.None); } }
/// <summary> /// The function of the cruise control unit. /// </summary> private void ccFunction() { // Written, 27.09.2018 if (this.isStockSteeringWheelInstalled) { RaycastHit hit; if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 1f, 1 << this.gameObject.layer)) { bool foundObject = false; bool foundParent = false; if (hit.transform?.gameObject?.name == "SATSUMA(557kg, 248)") { foundParent = true; GameObject gameObjectHit; gameObjectHit = hit.collider?.gameObject; if (gameObjectHit != null) { Action actionToPerform = null; if (gameObjectHit == clearButton) { foundObject = true; actionToPerform = this.onClear; } else { if (gameObjectHit == powerButton) { foundObject = true; actionToPerform = this.onPower; } else { if (gameObjectHit == resButton) { foundObject = true; actionToPerform = this.onRes; } else { if (gameObjectHit == setButton) { foundObject = true; actionToPerform = this.onSet; } } } } if (foundObject) { ModClient.guiInteract(gameObjectHit.name); if (CruiseControlMod.useButtonDown) { if (hasPower) { actionToPerform.Invoke(); } AudioSource audio = dashButtonAudioSource; audio.transform.position = gameObjectHit.transform.position; audio.Play(); } } } } if (foundParent && !foundObject) // Only reset if gui use was active. (my attempt at preventing flashing graphics gitch in text.) { ModClient.guiInteract(); } } } }