Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using SPModSettings;
- public class ActivateWithAirspeed_ModSettings : MonoBehaviour
- {
- private bool FXON; //if the game object (FX for reentry) is enabled or not
- public GameObject EnableDisableObj; //the empty or whatever you what to toggle
- public float ActivationSpeed = 1000; //speed in m/s of activation
- //MOD SETTINGS
- IModSettingsPage ReEntrySettings;
- IModSetting ActivationSpeedMS;
- // Start is called before the first frame update
- void Start()
- {
- }
- // Update is called once per frame
- void Update()
- {
- //check the plane's speed and see if its enough to activate the particles
- if (ServiceProvider.Instance.PlayerAircraft.Airspeed >= ActivationSpeed)
- {
- FXON = true; //if it is, turn on FX
- }
- else
- {
- FXON = false; //if it isn't make sure FX is off
- }
- //if the FX bool is on, activate the particles or whatever
- if (FXON == true)
- {
- EnableDisableObj.SetActive(true);
- }
- //if the FX bool is off, make sure particles aren't on or whatver
- if (FXON == false)
- {
- EnableDisableObj.SetActive(false);
- }
- //From AntiGravity ModSettings docs, by HellFireKoder
- //Mod settings- waits until settings load
- if (!ModSettingsHandler.ModSettingsReady)
- { // if the mod settings aren't ready to generate settings, wait
- return;
- }
- if (ReEntrySettings == null || ReEntrySettings.Equals(null))
- { // if we have no settings page\
- ReEntrySettings = ModSettingsHandler.AddSettingsPage("ReEntrySettings", "ReEntry Settings", "Setting for Re-Entry FX activation speed"); // generate page
- ActivationSpeedMS = ModSettingsHandler.AddSettingToPage(ReEntrySettings, "ActivationSpeed", "ActivationSpeed", ModSettingTypes.Numeric, 1000.ToString());// and settings
- SPModSettings.ModSettingsHandler.LoadSettingsForPage(ReEntrySettings); // load saved settings (if they've been saved before, otherwise defaults)
- }
- ReEntrySettings.GenerateSettingsXML();
- ActivationSpeed = float.Parse(ActivationSpeedMS.Value); //give the setting value to the variable as a float
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment