Exemplo n.º 1
0
        private void setValues()
        {
            // Written, 28.10.2020

            try
            {
                // GameObjects
                this.satuma     = GameObject.Find("SATSUMA(557kg, 248)");
                this.drivetrain = this.satuma.GetComponent <Drivetrain>();
                this.drivetrain.clutchTorqueMultiplier = 10f;
                this.carSimulation = this.satuma.transform.FindChild("CarSimulation").gameObject;
                this.engine        = this.carSimulation.transform.FindChild("Engine").gameObject;
                this.exhaust       = this.carSimulation.transform.FindChild("Exhaust").gameObject;
                PlayMakerFSM exhaustFSM = PlayMakerFSM.FindFsmOnGameObject(this.exhaust, "Logic");
                this.fromEngine            = exhaustFSM.FsmVariables.FindFsmGameObject("LocationEngine").Value;
                this.fromEngineOrginalPos  = this.fromEngine.transform.localPosition;
                this.fromEngineOrginalRot  = this.fromEngine.transform.localRotation;
                this.fromHeaders           = exhaustFSM.FsmVariables.FindFsmGameObject("LocationHeaders").Value;
                this.fromHeadersOrginalPos = this.fromHeaders.transform.localPosition;
                this.fromHeadersOrginalRot = this.fromHeaders.transform.localRotation;
                this.fromMuffler           = exhaustFSM.FsmVariables.FindFsmGameObject("LocationMuffler").Value;
                this.fromMufflerOrginalPos = this.fromMuffler.transform.localPosition;
                this.fromMufflerOrginalRot = this.fromMuffler.transform.localRotation;
                this.fromPipe           = exhaustFSM.FsmVariables.FindFsmGameObject("LocationPipe").Value;
                this.fromPipeOrginalPos = this.fromPipe.transform.localPosition;
                this.fromPipeOrginalRot = this.fromPipe.transform.localRotation;

                this.whistleSound              = this.gameObject.transform.FindChild("turbospool").gameObject.GetComponent <AudioSource>();
                this.whistleSound.minDistance  = 1;
                this.whistleSound.maxDistance  = 10;
                this.whistleSound.spatialBlend = 1;
                this.whistleSound.loop         = true;
                this.flutterSound              = this.gameObject.transform.FindChild("flutter").gameObject.GetComponent <AudioSource>();
                this.flutterSound.minDistance  = 1;
                this.flutterSound.maxDistance  = 10;
                this.flutterSound.spatialBlend = 1;
                this.flutterSound.loop         = false;
                this.flutterSound.mute         = false;
                // PlaymakerFSM
                this.carCoolingFSM            = this.carSimulation.transform.FindChild("Car/Cooling").gameObject.GetComponent <PlayMakerFSM>();
                this.backfireEvent            = this.engine.transform.FindChild("Symptoms").gameObject.GetComponent <PlayMakerFSM>();
                this.engineFuel               = this.engine.transform.FindChild("Fuel").gameObject;
                this.fuelFSM                  = this.engineFuel.gameObject.GetComponent <PlayMakerFSM>();
                this.fuelEventFSM             = this.engineFuel.gameObject.GetComponents <PlayMakerFSM>()[1];
                this.airFuelMixture           = this.fuelEventFSM.FsmVariables.FindFsmFloat("Mixture");
                this.airDensity               = this.fuelEventFSM.FsmVariables.FindFsmFloat("AirDensity");
                this.fuelPumpEfficiency       = this.fuelFSM.FsmVariables.GetFsmFloat("FuelPumpEfficiency");
                this.coolingAirRateMultiplier = this.carCoolingFSM.FsmVariables.FindFsmFloat("CoolingAirRateModifier");
                this.playerStressLevel        = PlayMakerGlobals.Instance.Variables.FindFsmFloat("PlayerStress");
                //this.engineOilFSM = this.oil
                this.engineTemp     = PlayMakerGlobals.Instance.Variables.FindFsmFloat("EngineTemp");
                this.fuel           = PlayMakerGlobals.Instance.Variables.FindFsmFloat("Fuel");
                this.currentVehicle = PlayMakerGlobals.Instance.Variables.FindFsmString("PlayerCurrentVehicle");
            }
            catch (Exception ex)
            {
                TurboMod.print("ERROR: {0}", ex.StackTrace);
                throw ex;
            }
        }
Exemplo n.º 2
0
        internal TurboModAssets(GameObject inPrefab)
        {
            // Written, 27.10.2020

            this.turboPartsPrefab = inPrefab;
            this.oilLines         = inPrefab.transform.GetChild(1).gameObject;
            TurboMod.print("{0}: found", this.oilLines.name);
            this.wastegateActuator = inPrefab.transform.GetChild(2).gameObject;
            TurboMod.print("{0}: found", this.wastegateActuator.name);
            this.oilCooler = inPrefab.transform.GetChild(3).gameObject;
            TurboMod.print("{0}: found", this.oilCooler.name);
            this.airFilter = inPrefab.transform.GetChild(4).gameObject;
            TurboMod.print("{0}: found", this.airFilter.name);
            this.highFlowAirFilter = inPrefab.transform.GetChild(5).gameObject;
            TurboMod.print("{0}: found", this.highFlowAirFilter.name);
            this.headers = inPrefab.transform.GetChild(6).gameObject;
            TurboMod.print("{0}: found", this.headers.name);
            this.chargePipeHotSide_race = inPrefab.transform.GetChild(7).gameObject;
            TurboMod.print("{0}: found", this.chargePipeHotSide_race.name);
            this.intercooler = inPrefab.transform.GetChild(8).gameObject;
            TurboMod.print("{0}: found", this.intercooler.name);
            this.chargePipeColdSide_race = inPrefab.transform.GetChild(9).gameObject;
            TurboMod.print("{0}: found", this.chargePipeColdSide_race.name);
            this.turbo = inPrefab.transform.GetChild(10).gameObject;
            TurboMod.print("{0}: found", this.turbo.name);
            this.boostGauge = inPrefab.transform.GetChild(11).gameObject;
            TurboMod.print("{0}: found", this.boostGauge.name);
            this.carbPipe = inPrefab.transform.GetChild(12).gameObject;
            TurboMod.print("{0}: found", this.carbPipe.name);
            this.downPipe_race = inPrefab.transform.GetChild(13).gameObject;
            TurboMod.print("{0}: found", this.downPipe_race.name);
        }
Exemplo n.º 3
0
        void OnGUI()
        {
            // Written, 30.10.2020

            if (this.debugGuiKey.GetKeybindDown())
            {
                this.showDebugGUI = !this.showDebugGUI;
            }
            if (this.showDebugGUI)
            {
                string text = string.Empty;
                try
                {
                    string turboStatus = string.Empty;
                    if (this.turboParts.isCorePartsInstalled())
                    {
                        turboStatus = "+ Core parts installed: ";
                    }
                    else
                    {
                        turboStatus = "+ Core parts not installed:\n";
                    }
                    float _calculatedBoost = this.calculateMaxBoost();
                    turboStatus += _calculatedBoost + " psi\nDelayed:(" + this.calculatedBoost + ") psi";
                    turboStatus += "\n differance: " + (Mathf.Abs(_calculatedBoost - this.calculatedBoost));
                    if (this.turboParts.carbPipePart.installed)
                    {
                        turboStatus += "\n+ Carburator pipe installed";
                    }
                    else
                    {
                        turboStatus += "\n+ Carburator pipe not installed";
                    }
                    if (this.turboParts.oilCoolerPart.installed)
                    {
                        turboStatus += "\n+ Oil cooler installed";
                    }
                    else
                    {
                        turboStatus += "\n+ Oil cooler not installed";
                    }
                    if (this.turboParts.wastegateActuatorPart.installed)
                    {
                        turboStatus += "\n+ Wastegate installed";
                    }
                    else
                    {
                        turboStatus += "\n+ Wastegate not installed";
                    }
                    turboStatus += " (" + this.wastegatePsi + "psi)";
                    if (this.turboParts.airFilterPart.installed)
                    {
                        turboStatus += "\n+ Air filter installed";
                    }
                    else if (this.turboParts.highFlowAirFilterPart.installed)
                    {
                        turboStatus += "\n+ High flow air filter installed";
                    }
                    else
                    {
                        turboStatus += "\n+ No air filter installed";
                    }
                    turboStatus += "()";
                    turboStatus += "\nWhistle pitch modifier (rpm*modifier): " + this.whistlePitchModifier;
                    turboStatus += "\nFlutter pitch absolute: " + this.flutterPitch;
                    turboStatus += "\nTurbo lag: " + this.turboDelayModifier;
                    turboStatus += "\nTurbo spool delay modifier: " + this.turboSpoolDelayModifier;
                    turboStatus += "\nTurbo spool delay time: " + this.turboSpoolDelayTime;
                    turboStatus += "\nEditing Choice: " + this.adjustWhat;
                    turboStatus += "\npotential power modifier: " + this.appliedPowerMultiplier;
                    if (this.turboParts.isCorePartsInstalled() && this.turboParts.carbPipePart.installed)
                    {
                        turboStatus += " (";
                    }
                    else
                    {
                        turboStatus += " (NOT";
                    }
                    turboStatus += " APPLIED)";
                    string satsumaStats = string.Format("HP: {0}\nPower modifier: {1}\nTorque: {2}\nEngine temp: {3}\nThrottle: {4}\nIdle Throttle: {5}\nClutch max torque: {6}\nClutch torque modifier: {7}" +
                                                        "\nAF Mixture: {8}\nAir density: {9}\nAF Modifier: {10}",
                                                        Math.Round(this.drivetrain.currentPower, 2), Math.Round(this.drivetrain.powerMultiplier, 2),
                                                        Math.Round(this.drivetrain.torque, 2), Math.Round(this.engineTemp.Value, 2), this.drivetrain.throttle, this.drivetrain.idlethrottle,
                                                        this.drivetrain.clutchMaxTorque, this.drivetrain.clutchTorqueMultiplier, this.airFuelMixture.Value, this.airDensity.Value, this.airFuelRatioModifier);
                    text = string.Format(
                        "------------------------------------------------------------" +
                        "\nTurbo Stats:\n" + turboStatus + "\n------------------------------------------------------------" +
                        "\nSatsuma Stats:\n" + satsumaStats + "\n------------------------------------------------------------");
                }
                catch (Exception ex)
                {
                    text = "ERROR {0}";
                    TurboMod.print(text, ex.StackTrace);
                }
                finally
                {
                    GUI.Label(new Rect(20, 20, 500, 500), text);
                }
            }
        }