687 lines
36 KiB
C#
687 lines
36 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using TMPro;
|
|
using UnityEngine.UI;
|
|
|
|
public class SimulationController : MonoBehaviour
|
|
{
|
|
public static SimulationController Instance;
|
|
|
|
[Header("UI åëåìåíòè")]
|
|
public TextMeshProUGUI layerNameText;
|
|
public TextMeshProUGUI layerInfoText;
|
|
public TextMeshProUGUI percentageText;
|
|
public Slider progressSlider;
|
|
|
|
[Header("Êíîïêè")]
|
|
public Button nextButton;
|
|
public Button prevButton;
|
|
|
|
private PlanetDatabase.PlanetInfo currentPlanetInfo;
|
|
private int currentLayerIndex;
|
|
private bool layerInitialized = false;
|
|
|
|
void Awake()
|
|
{
|
|
Instance = this;
|
|
}
|
|
|
|
public void StartLayer(int layerIndex, PlanetDatabase.PlanetInfo planetInfo)
|
|
{
|
|
currentPlanetInfo = planetInfo;
|
|
currentLayerIndex = layerIndex;
|
|
layerInitialized = false;
|
|
|
|
if (progressSlider != null)
|
|
{
|
|
progressSlider.minValue = 0f;
|
|
progressSlider.maxValue = 4f;
|
|
progressSlider.wholeNumbers = true;
|
|
progressSlider.value = 4f;
|
|
progressSlider.onValueChanged.RemoveAllListeners();
|
|
progressSlider.onValueChanged.AddListener(OnSliderChanged);
|
|
}
|
|
|
|
if (prevButton != null)
|
|
prevButton.interactable = currentLayerIndex > 0;
|
|
|
|
if (nextButton != null)
|
|
nextButton.interactable = currentLayerIndex < currentPlanetInfo.layers.Length - 1;
|
|
|
|
UpdateUI();
|
|
InitCurrentLayer();
|
|
UpdateLayerSimulation(1f);
|
|
}
|
|
|
|
void InitCurrentLayer()
|
|
{
|
|
if (layerInitialized) return;
|
|
layerInitialized = true;
|
|
var atmo = GameManager.Instance.GetCurrentPlanet().atmosphereSystem;
|
|
if (atmo == null) return;
|
|
switch (currentLayerIndex)
|
|
{
|
|
case 0:
|
|
var tropo = atmo.GetComponentInChildren<TroposphereEffects>(true);
|
|
if (tropo != null && !tropo.enabled) tropo.enabled = true;
|
|
var mercury = atmo.GetComponentInChildren<MercuryEffects>(true);
|
|
if (mercury != null && !mercury.enabled)
|
|
{
|
|
mercury.enabled = true;
|
|
mercury.InitState();
|
|
}
|
|
var marsEff = atmo.GetComponentInChildren<MarsEffects>(true);
|
|
if (marsEff != null && !marsEff.enabled)
|
|
{
|
|
marsEff.enabled = true;
|
|
marsEff.InitState();
|
|
}
|
|
if (GameManager.Instance.GetCurrentPlanet().planetKey == "Mars")
|
|
{
|
|
var marsAtmo = atmo.GetComponentInChildren<MarsAtmosphereSystem>(true);
|
|
if (marsAtmo != null)
|
|
{
|
|
marsAtmo.SetLayerActive("Layer_Mesosphere", false);
|
|
marsAtmo.SetLayerActive("Layer_Thermosphere", false);
|
|
marsAtmo.SetLayerActive("Layer_Exosphere", false);
|
|
}
|
|
}
|
|
if (GameManager.Instance.GetCurrentPlanet().planetKey == "Jupiter")
|
|
{
|
|
var jupiterAtmo = atmo.GetComponentInChildren<JupiterAtmosphereSystem>(true);
|
|
if (jupiterAtmo != null)
|
|
{
|
|
jupiterAtmo.SetLayerActive("Layer_Stratosphere", false);
|
|
jupiterAtmo.SetLayerActive("Layer_Thermosphere", false);
|
|
jupiterAtmo.SetLayerActive("Layer_Exosphere", false);
|
|
}
|
|
var jupiterTropo = atmo.GetComponentInChildren<JupiterTroposphereEffects>(true);
|
|
if (jupiterTropo != null && !jupiterTropo.enabled)
|
|
{
|
|
jupiterTropo.enabled = true;
|
|
jupiterTropo.InitState();
|
|
}
|
|
var jupiterStratoGlow0 = atmo.GetComponentInChildren<JupiterStratosphereEffects>(true);
|
|
if (jupiterStratoGlow0 != null && jupiterStratoGlow0.jupiterGlow != null)
|
|
jupiterStratoGlow0.jupiterGlow.Stop();
|
|
}
|
|
if (GameManager.Instance.GetCurrentPlanet().planetKey == "Saturn")
|
|
{
|
|
var saturnAtmo = atmo.GetComponentInChildren<SaturnAtmosphereSystem>(true);
|
|
if (saturnAtmo != null)
|
|
{
|
|
saturnAtmo.SetLayerActive("Layer_Stratosphere", false);
|
|
saturnAtmo.SetLayerActive("Layer_Thermosphere", false);
|
|
saturnAtmo.SetLayerActive("Layer_Exosphere", false);
|
|
}
|
|
var saturnTropo = atmo.GetComponentInChildren<SaturnTroposphereEffects>(true);
|
|
if (saturnTropo != null && !saturnTropo.enabled)
|
|
{
|
|
saturnTropo.enabled = true;
|
|
saturnTropo.InitState();
|
|
}
|
|
}
|
|
if (GameManager.Instance.GetCurrentPlanet().planetKey == "Uranus")
|
|
{
|
|
var uranusAtmo = atmo.GetComponentInChildren<UranusAtmosphereSystem>(true);
|
|
if (uranusAtmo != null)
|
|
{
|
|
uranusAtmo.SetLayerActive("Layer_Stratosphere", false);
|
|
uranusAtmo.SetLayerActive("Layer_Thermosphere", false);
|
|
}
|
|
var uranusTropo = atmo.GetComponentInChildren<UranusTroposphereEffects>(true);
|
|
if (uranusTropo != null && !uranusTropo.enabled)
|
|
{
|
|
uranusTropo.enabled = true;
|
|
uranusTropo.InitState();
|
|
}
|
|
}
|
|
if (GameManager.Instance.GetCurrentPlanet().planetKey == "Neptune")
|
|
{
|
|
var neptuneAtmo = atmo.GetComponentInChildren<NeptuneAtmosphereSystem>(true);
|
|
if (neptuneAtmo != null)
|
|
{
|
|
neptuneAtmo.SetLayerActive("Layer_Stratosphere", false);
|
|
neptuneAtmo.SetLayerActive("Layer_Thermosphere", false);
|
|
}
|
|
var neptuneTropo = atmo.GetComponentInChildren<NeptuneTroposphereEffects>(true);
|
|
if (neptuneTropo != null && !neptuneTropo.enabled)
|
|
{
|
|
neptuneTropo.enabled = true;
|
|
neptuneTropo.InitState();
|
|
}
|
|
}
|
|
break;
|
|
|
|
case 1:
|
|
var strato = atmo.GetComponentInChildren<StratosphereEffects>(true);
|
|
if (strato != null && !strato.enabled) strato.enabled = true;
|
|
var stratoDeath = atmo.GetComponentInChildren<StratosphereDeath>(true);
|
|
if (stratoDeath != null && !stratoDeath.enabled)
|
|
{
|
|
stratoDeath.enabled = true;
|
|
stratoDeath.InitState();
|
|
}
|
|
var venusEff = atmo.GetComponentInChildren<VenusEffects>(true);
|
|
if (venusEff != null && !venusEff.enabled)
|
|
{
|
|
venusEff.enabled = true;
|
|
venusEff.InitState();
|
|
}
|
|
var marsMeso = atmo.GetComponentInChildren<MarsMesosphereEffects>(true);
|
|
if (marsMeso != null && !marsMeso.enabled)
|
|
{
|
|
marsMeso.enabled = true;
|
|
marsMeso.InitState();
|
|
}
|
|
if (GameManager.Instance.GetCurrentPlanet().planetKey == "Mars")
|
|
{
|
|
var marsAtmo = atmo.GetComponentInChildren<MarsAtmosphereSystem>(true);
|
|
if (marsAtmo != null)
|
|
{
|
|
marsAtmo.SetLayerActive("Layer_Troposphere", false);
|
|
marsAtmo.SetLayerActive("Layer_Thermosphere", false);
|
|
marsAtmo.SetLayerActive("Layer_Exosphere", false);
|
|
marsAtmo.SetLayerActive("Layer_Mesosphere", true);
|
|
}
|
|
}
|
|
if (GameManager.Instance.GetCurrentPlanet().planetKey == "Jupiter")
|
|
{
|
|
var jupiterAtmo = atmo.GetComponentInChildren<JupiterAtmosphereSystem>(true);
|
|
if (jupiterAtmo != null)
|
|
{
|
|
jupiterAtmo.SetLayerActive("Layer_Troposphere", false);
|
|
jupiterAtmo.SetLayerActive("Layer_Thermosphere", false);
|
|
jupiterAtmo.SetLayerActive("Layer_Exosphere", false);
|
|
jupiterAtmo.SetLayerActive("Layer_Stratosphere", true);
|
|
}
|
|
var jupiterStrato = atmo.GetComponentInChildren<JupiterStratosphereEffects>(true);
|
|
if (jupiterStrato != null && !jupiterStrato.enabled)
|
|
{
|
|
jupiterStrato.enabled = true;
|
|
jupiterStrato.InitState();
|
|
}
|
|
}
|
|
if (GameManager.Instance.GetCurrentPlanet().planetKey == "Saturn")
|
|
{
|
|
var saturnAtmo = atmo.GetComponentInChildren<SaturnAtmosphereSystem>(true);
|
|
if (saturnAtmo != null)
|
|
{
|
|
saturnAtmo.SetLayerActive("Layer_Troposphere", false);
|
|
saturnAtmo.SetLayerActive("Layer_Thermosphere", false);
|
|
saturnAtmo.SetLayerActive("Layer_Exosphere", false);
|
|
saturnAtmo.SetLayerActive("Layer_Stratosphere", true);
|
|
}
|
|
var saturnStrato = atmo.GetComponentInChildren<SaturnStratosphereEffects>(true);
|
|
if (saturnStrato != null && !saturnStrato.enabled)
|
|
{
|
|
saturnStrato.enabled = true;
|
|
saturnStrato.InitState();
|
|
}
|
|
}
|
|
if (GameManager.Instance.GetCurrentPlanet().planetKey == "Uranus")
|
|
{
|
|
var uranusAtmo = atmo.GetComponentInChildren<UranusAtmosphereSystem>(true);
|
|
if (uranusAtmo != null)
|
|
{
|
|
uranusAtmo.SetLayerActive("Layer_Troposphere", false);
|
|
uranusAtmo.SetLayerActive("Layer_Thermosphere", false);
|
|
uranusAtmo.SetLayerActive("Layer_Stratosphere", true);
|
|
}
|
|
var uranusStrato = atmo.GetComponentInChildren<UranusStratosphereEffects>(true);
|
|
if (uranusStrato != null && !uranusStrato.enabled)
|
|
{
|
|
uranusStrato.enabled = true;
|
|
uranusStrato.InitState();
|
|
}
|
|
}
|
|
if (GameManager.Instance.GetCurrentPlanet().planetKey == "Neptune")
|
|
{
|
|
var neptuneAtmo = atmo.GetComponentInChildren<NeptuneAtmosphereSystem>(true);
|
|
if (neptuneAtmo != null)
|
|
{
|
|
neptuneAtmo.SetLayerActive("Layer_Troposphere", false);
|
|
neptuneAtmo.SetLayerActive("Layer_Thermosphere", false);
|
|
neptuneAtmo.SetLayerActive("Layer_Stratosphere", true);
|
|
}
|
|
var neptuneStrato = atmo.GetComponentInChildren<NeptuneStratosphereEffects>(true);
|
|
if (neptuneStrato != null && !neptuneStrato.enabled)
|
|
{
|
|
neptuneStrato.enabled = true;
|
|
neptuneStrato.InitState();
|
|
}
|
|
}
|
|
break;
|
|
|
|
case 2:
|
|
var meso = atmo.GetComponentInChildren<MesosphereEffects>(true);
|
|
if (meso != null && !meso.enabled) meso.enabled = true;
|
|
var venusThermo = atmo.GetComponentInChildren<VenusThermosphereEffects>(true);
|
|
if (venusThermo != null && !venusThermo.enabled)
|
|
{
|
|
venusThermo.enabled = true;
|
|
venusThermo.InitState();
|
|
}
|
|
var marsThermo = atmo.GetComponentInChildren<MarsThermosphereEffects>(true);
|
|
if (marsThermo != null && !marsThermo.enabled)
|
|
{
|
|
marsThermo.enabled = true;
|
|
marsThermo.InitState();
|
|
}
|
|
if (GameManager.Instance.GetCurrentPlanet().planetKey == "Mars")
|
|
{
|
|
var marsAtmo2 = atmo.GetComponentInChildren<MarsAtmosphereSystem>(true);
|
|
if (marsAtmo2 != null)
|
|
{
|
|
marsAtmo2.SetLayerActive("Layer_Troposphere", false);
|
|
marsAtmo2.SetLayerActive("Layer_Mesosphere", false);
|
|
marsAtmo2.SetLayerActive("Layer_Exosphere", false);
|
|
marsAtmo2.SetLayerActive("Layer_Thermosphere", true);
|
|
}
|
|
}
|
|
if (GameManager.Instance.GetCurrentPlanet().planetKey == "Jupiter")
|
|
{
|
|
var jupiterAtmo = atmo.GetComponentInChildren<JupiterAtmosphereSystem>(true);
|
|
if (jupiterAtmo != null)
|
|
{
|
|
jupiterAtmo.SetLayerActive("Layer_Troposphere", false);
|
|
jupiterAtmo.SetLayerActive("Layer_Stratosphere", false);
|
|
jupiterAtmo.SetLayerActive("Layer_Exosphere", false);
|
|
jupiterAtmo.SetLayerActive("Layer_Thermosphere", true);
|
|
}
|
|
var jupiterThermo = atmo.GetComponentInChildren<JupiterThermosphereEffects>(true);
|
|
if (jupiterThermo != null && !jupiterThermo.enabled)
|
|
{
|
|
jupiterThermo.enabled = true;
|
|
jupiterThermo.InitState();
|
|
}
|
|
var jupiterStratoGlow2 = atmo.GetComponentInChildren<JupiterStratosphereEffects>(true);
|
|
if (jupiterStratoGlow2 != null && jupiterStratoGlow2.jupiterGlow != null)
|
|
jupiterStratoGlow2.jupiterGlow.Stop();
|
|
}
|
|
if (GameManager.Instance.GetCurrentPlanet().planetKey == "Saturn")
|
|
{
|
|
var saturnAtmo = atmo.GetComponentInChildren<SaturnAtmosphereSystem>(true);
|
|
if (saturnAtmo != null)
|
|
{
|
|
saturnAtmo.SetLayerActive("Layer_Troposphere", false);
|
|
saturnAtmo.SetLayerActive("Layer_Stratosphere", false);
|
|
saturnAtmo.SetLayerActive("Layer_Exosphere", false);
|
|
saturnAtmo.SetLayerActive("Layer_Thermosphere", true);
|
|
}
|
|
var saturnThermo = atmo.GetComponentInChildren<SaturnThermosphereEffects>(true);
|
|
if (saturnThermo != null && !saturnThermo.enabled)
|
|
{
|
|
saturnThermo.enabled = true;
|
|
saturnThermo.InitState();
|
|
}
|
|
}
|
|
if (GameManager.Instance.GetCurrentPlanet().planetKey == "Uranus")
|
|
{
|
|
var uranusAtmo = atmo.GetComponentInChildren<UranusAtmosphereSystem>(true);
|
|
if (uranusAtmo != null)
|
|
{
|
|
uranusAtmo.SetLayerActive("Layer_Troposphere", false);
|
|
uranusAtmo.SetLayerActive("Layer_Stratosphere", false);
|
|
uranusAtmo.SetLayerActive("Layer_Thermosphere", true);
|
|
}
|
|
var uranusThermo = atmo.GetComponentInChildren<UranusThermosphereEffects>(true);
|
|
if (uranusThermo != null && !uranusThermo.enabled)
|
|
{
|
|
uranusThermo.enabled = true;
|
|
uranusThermo.InitState();
|
|
}
|
|
}
|
|
if (GameManager.Instance.GetCurrentPlanet().planetKey == "Neptune")
|
|
{
|
|
var neptuneAtmo = atmo.GetComponentInChildren<NeptuneAtmosphereSystem>(true);
|
|
if (neptuneAtmo != null)
|
|
{
|
|
neptuneAtmo.SetLayerActive("Layer_Troposphere", false);
|
|
neptuneAtmo.SetLayerActive("Layer_Stratosphere", false);
|
|
neptuneAtmo.SetLayerActive("Layer_Thermosphere", true);
|
|
}
|
|
var neptuneThermo = atmo.GetComponentInChildren<NeptuneThermosphereEffects>(true);
|
|
if (neptuneThermo != null && !neptuneThermo.enabled)
|
|
{
|
|
neptuneThermo.enabled = true;
|
|
neptuneThermo.InitState();
|
|
}
|
|
}
|
|
break;
|
|
|
|
case 3:
|
|
var thermo = atmo.GetComponentInChildren<ThermosphereEffects>(true);
|
|
if (thermo != null)
|
|
{
|
|
if (!thermo.enabled)
|
|
{
|
|
thermo.enabled = true;
|
|
thermo.InitStateAndSpawn();
|
|
}
|
|
thermo.thermosphereLevel = 1f;
|
|
}
|
|
var venusExo = atmo.GetComponentInChildren<VenusExosphereEffects>(true);
|
|
if (venusExo != null && !venusExo.enabled)
|
|
{
|
|
venusExo.enabled = true;
|
|
venusExo.InitState();
|
|
}
|
|
if (GameManager.Instance.GetCurrentPlanet().planetKey == "Mars")
|
|
{
|
|
var marsAtmo3 = atmo.GetComponentInChildren<MarsAtmosphereSystem>(true);
|
|
if (marsAtmo3 != null)
|
|
{
|
|
marsAtmo3.SetLayerActive("Layer_Troposphere", false);
|
|
marsAtmo3.SetLayerActive("Layer_Mesosphere", false);
|
|
marsAtmo3.SetLayerActive("Layer_Thermosphere", false);
|
|
marsAtmo3.SetLayerActive("Layer_Exosphere", true);
|
|
}
|
|
}
|
|
if (GameManager.Instance.GetCurrentPlanet().planetKey == "Jupiter")
|
|
{
|
|
var jupiterAtmo = atmo.GetComponentInChildren<JupiterAtmosphereSystem>(true);
|
|
if (jupiterAtmo != null)
|
|
{
|
|
jupiterAtmo.SetLayerActive("Layer_Troposphere", false);
|
|
jupiterAtmo.SetLayerActive("Layer_Stratosphere", false);
|
|
jupiterAtmo.SetLayerActive("Layer_Thermosphere", false);
|
|
jupiterAtmo.SetLayerActive("Layer_Exosphere", true);
|
|
}
|
|
var jupiterExo = atmo.GetComponentInChildren<JupiterExosphereEffects>(true);
|
|
if (jupiterExo != null && !jupiterExo.enabled)
|
|
{
|
|
jupiterExo.enabled = true;
|
|
jupiterExo.InitState();
|
|
}
|
|
var jupiterStratoGlow3 = atmo.GetComponentInChildren<JupiterStratosphereEffects>(true);
|
|
if (jupiterStratoGlow3 != null && jupiterStratoGlow3.jupiterGlow != null)
|
|
jupiterStratoGlow3.jupiterGlow.Stop();
|
|
}
|
|
if (GameManager.Instance.GetCurrentPlanet().planetKey == "Saturn")
|
|
{
|
|
var saturnAtmo = atmo.GetComponentInChildren<SaturnAtmosphereSystem>(true);
|
|
if (saturnAtmo != null)
|
|
{
|
|
saturnAtmo.SetLayerActive("Layer_Troposphere", false);
|
|
saturnAtmo.SetLayerActive("Layer_Stratosphere", false);
|
|
saturnAtmo.SetLayerActive("Layer_Thermosphere", false);
|
|
saturnAtmo.SetLayerActive("Layer_Exosphere", true);
|
|
}
|
|
var saturnExo = atmo.GetComponentInChildren<SaturnExosphereEffects>(true);
|
|
if (saturnExo != null && !saturnExo.enabled)
|
|
{
|
|
saturnExo.enabled = true;
|
|
saturnExo.InitState();
|
|
}
|
|
}
|
|
break;
|
|
|
|
case 4:
|
|
var exo = atmo.GetComponentInChildren<ExosphereEffects>(true);
|
|
if (exo != null && !exo.enabled) exo.enabled = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
void OnSliderChanged(float value)
|
|
{
|
|
float level = SliderToLevel(value);
|
|
int percent = Mathf.RoundToInt(level * 100f);
|
|
|
|
if (percentageText != null)
|
|
percentageText.text = "³äñîòêè: " + percent + "%";
|
|
|
|
UpdateLayerText(level);
|
|
UpdateLayerSimulation(level);
|
|
}
|
|
|
|
float SliderToLevel(float sliderValue)
|
|
{
|
|
switch (Mathf.RoundToInt(sliderValue))
|
|
{
|
|
case 4: return 1f;
|
|
case 3: return 0.7f;
|
|
case 2: return 0.5f;
|
|
case 1: return 0.3f;
|
|
case 0: return 0f;
|
|
default: return 1f;
|
|
}
|
|
}
|
|
|
|
void UpdateLayerText(float level)
|
|
{
|
|
if (currentPlanetInfo?.layers == null) return;
|
|
if (currentLayerIndex >= currentPlanetInfo.layers.Length) return;
|
|
|
|
var layer = currentPlanetInfo.layers[currentLayerIndex];
|
|
if (layerInfoText == null) return;
|
|
|
|
if (level >= 1f)
|
|
layerInfoText.text = layer.description;
|
|
else if (level >= 0.7f)
|
|
layerInfoText.text = layer.importance;
|
|
else if (level >= 0.5f)
|
|
layerInfoText.text = layer.threat;
|
|
else if (level >= 0.3f)
|
|
layerInfoText.text = layer.howToProtect;
|
|
else
|
|
layerInfoText.text = "Øàð ïîâí³ñòþ çðóéíîâàíî. Íàñë³äêè äëÿ ïëàíåòè º íåçâîðîòíèìè.";
|
|
}
|
|
void UpdateLayerSimulation(float value)
|
|
{
|
|
PlanetDeath pd = GameObject.FindObjectOfType<PlanetDeath>();
|
|
if (pd == null) return;
|
|
var atmo = GameManager.Instance.GetCurrentPlanet().atmosphereSystem;
|
|
if (atmo == null) return;
|
|
|
|
switch (currentLayerIndex)
|
|
{
|
|
case 0:
|
|
pd.troposphereLevel = value;
|
|
var mercuryEff = atmo.GetComponentInChildren<MercuryEffects>(true);
|
|
if (mercuryEff != null) mercuryEff.exosphereLevel = value;
|
|
var mercuryAtmo = atmo.GetComponentInChildren<MercuryAtmosphereSystem>(true);
|
|
if (mercuryAtmo != null) mercuryAtmo.SetIntensity(value);
|
|
var venusDeath = GameManager.Instance.GetCurrentPlanet()
|
|
.planetTransform?.GetComponent<VenusDeath>();
|
|
if (venusDeath != null) venusDeath.troposphereLevel = value;
|
|
var venusAtmo = atmo.GetComponentInChildren<VenusAtmosphereSystem>(true);
|
|
if (venusAtmo != null) venusAtmo.SetIntensity(value);
|
|
var marsEff = atmo.GetComponentInChildren<MarsEffects>(true);
|
|
if (marsEff != null) marsEff.troposphereLevel = value;
|
|
var marsDeath0 = GameManager.Instance.GetCurrentPlanet()
|
|
.planetTransform?.GetComponent<MarsDeath>();
|
|
if (marsDeath0 != null) marsDeath0.troposphereLevel = value;
|
|
var marsAtmo = atmo.GetComponentInChildren<MarsAtmosphereSystem>(true);
|
|
if (marsAtmo != null) marsAtmo.SetLayerIntensity("Layer_Troposphere", value);
|
|
var jupiterDeath0 = GameManager.Instance.GetCurrentPlanet()
|
|
.planetTransform?.GetComponent<JupiterDeath>();
|
|
if (jupiterDeath0 != null) jupiterDeath0.troposphereLevel = value;
|
|
var jupiterAtmo0 = atmo.GetComponentInChildren<JupiterAtmosphereSystem>(true);
|
|
if (jupiterAtmo0 != null) jupiterAtmo0.SetLayerIntensity("Layer_Troposphere", value);
|
|
var jupiterTropo0 = atmo.GetComponentInChildren<JupiterTroposphereEffects>(true);
|
|
if (jupiterTropo0 != null) jupiterTropo0.troposphereLevel = value;
|
|
var saturnDeath0 = GameManager.Instance.GetCurrentPlanet()
|
|
.planetTransform?.GetComponent<SaturnDeath>();
|
|
if (saturnDeath0 != null) saturnDeath0.troposphereLevel = value;
|
|
var saturnAtmo0 = atmo.GetComponentInChildren<SaturnAtmosphereSystem>(true);
|
|
if (saturnAtmo0 != null) saturnAtmo0.SetLayerIntensity("Layer_Troposphere", value);
|
|
var saturnTropo0 = atmo.GetComponentInChildren<SaturnTroposphereEffects>(true);
|
|
if (saturnTropo0 != null) saturnTropo0.troposphereLevel = value;
|
|
var uranusDeath0 = GameManager.Instance.GetCurrentPlanet()
|
|
.planetTransform?.GetComponent<UranusDeath>();
|
|
if (uranusDeath0 != null) uranusDeath0.troposphereLevel = value;
|
|
var uranusAtmo0 = atmo.GetComponentInChildren<UranusAtmosphereSystem>(true);
|
|
if (uranusAtmo0 != null) uranusAtmo0.SetLayerIntensity("Layer_Troposphere", value);
|
|
var uranusTropo0 = atmo.GetComponentInChildren<UranusTroposphereEffects>(true);
|
|
if (uranusTropo0 != null) uranusTropo0.troposphereLevel = value;
|
|
var neptuneDeath0 = GameManager.Instance.GetCurrentPlanet()
|
|
.planetTransform?.GetComponent<NeptuneDeath>();
|
|
if (neptuneDeath0 != null) neptuneDeath0.troposphereLevel = value;
|
|
var neptuneAtmo0 = atmo.GetComponentInChildren<NeptuneAtmosphereSystem>(true);
|
|
if (neptuneAtmo0 != null) neptuneAtmo0.SetLayerIntensity("Layer_Troposphere", value);
|
|
var neptuneTropo0 = atmo.GetComponentInChildren<NeptuneTroposphereEffects>(true);
|
|
if (neptuneTropo0 != null) neptuneTropo0.troposphereLevel = value;
|
|
break;
|
|
|
|
case 1:
|
|
pd.stratosphereLevel = value;
|
|
var venusEff = atmo.GetComponentInChildren<VenusEffects>(true);
|
|
if (venusEff != null) venusEff.mesosphereLevel = value;
|
|
var venusAtmo2 = atmo.GetComponentInChildren<VenusAtmosphereSystem>(true);
|
|
if (venusAtmo2 != null) venusAtmo2.SetLayerIntensity("Layer_Mesosphere", value);
|
|
var venusDeath2 = GameManager.Instance.GetCurrentPlanet()
|
|
.planetTransform?.GetComponent<VenusDeath>();
|
|
if (venusDeath2 != null) venusDeath2.mesosphereLevel = value;
|
|
var marsAtmo2 = atmo.GetComponentInChildren<MarsAtmosphereSystem>(true);
|
|
if (marsAtmo2 != null) marsAtmo2.SetLayerIntensity("Layer_Mesosphere", value);
|
|
var marsMeso = atmo.GetComponentInChildren<MarsMesosphereEffects>(true);
|
|
if (marsMeso != null) marsMeso.mesosphereLevel = value;
|
|
var marsDeath1 = GameManager.Instance.GetCurrentPlanet()
|
|
.planetTransform?.GetComponent<MarsDeath>();
|
|
if (marsDeath1 != null) marsDeath1.mesosphereLevel = value;
|
|
var jupiterAtmo1 = atmo.GetComponentInChildren<JupiterAtmosphereSystem>(true);
|
|
if (jupiterAtmo1 != null) jupiterAtmo1.SetLayerIntensity("Layer_Stratosphere", value);
|
|
var jupiterStrato1 = atmo.GetComponentInChildren<JupiterStratosphereEffects>(true);
|
|
if (jupiterStrato1 != null) jupiterStrato1.stratosphereLevel = value;
|
|
var jupiterDeath1 = GameManager.Instance.GetCurrentPlanet()
|
|
.planetTransform?.GetComponent<JupiterDeath>();
|
|
if (jupiterDeath1 != null) jupiterDeath1.stratosphereLevel = value;
|
|
var saturnAtmo1 = atmo.GetComponentInChildren<SaturnAtmosphereSystem>(true);
|
|
if (saturnAtmo1 != null) saturnAtmo1.SetLayerIntensity("Layer_Stratosphere", value);
|
|
var saturnStrato1 = atmo.GetComponentInChildren<SaturnStratosphereEffects>(true);
|
|
if (saturnStrato1 != null) saturnStrato1.stratosphereLevel = value;
|
|
var saturnDeath1 = GameManager.Instance.GetCurrentPlanet()
|
|
.planetTransform?.GetComponent<SaturnDeath>();
|
|
if (saturnDeath1 != null) saturnDeath1.stratosphereLevel = value;
|
|
var uranusAtmo1 = atmo.GetComponentInChildren<UranusAtmosphereSystem>(true);
|
|
if (uranusAtmo1 != null) uranusAtmo1.SetLayerIntensity("Layer_Stratosphere", value);
|
|
var uranusStrato1 = atmo.GetComponentInChildren<UranusStratosphereEffects>(true);
|
|
if (uranusStrato1 != null) uranusStrato1.stratosphereLevel = value;
|
|
var uranusDeath1 = GameManager.Instance.GetCurrentPlanet()
|
|
.planetTransform?.GetComponent<UranusDeath>();
|
|
if (uranusDeath1 != null) uranusDeath1.stratosphereLevel = value;
|
|
var neptuneAtmo1 = atmo.GetComponentInChildren<NeptuneAtmosphereSystem>(true);
|
|
if (neptuneAtmo1 != null) neptuneAtmo1.SetLayerIntensity("Layer_Stratosphere", value);
|
|
var neptuneStrato1 = atmo.GetComponentInChildren<NeptuneStratosphereEffects>(true);
|
|
if (neptuneStrato1 != null) neptuneStrato1.stratosphereLevel = value;
|
|
var neptuneDeath1 = GameManager.Instance.GetCurrentPlanet()
|
|
.planetTransform?.GetComponent<NeptuneDeath>();
|
|
if (neptuneDeath1 != null) neptuneDeath1.stratosphereLevel = value;
|
|
break;
|
|
|
|
case 2:
|
|
pd.mesosphereLevel = value;
|
|
var venusDeath3 = GameManager.Instance.GetCurrentPlanet()
|
|
.planetTransform?.GetComponent<VenusDeath>();
|
|
if (venusDeath3 != null) venusDeath3.thermosphereLevel = (1f - value) * 15f;
|
|
var venusAtmo3 = atmo.GetComponentInChildren<VenusAtmosphereSystem>(true);
|
|
if (venusAtmo3 != null) venusAtmo3.SetLayerIntensity("Layer_Thermosphere", value);
|
|
var venusThermo = atmo.GetComponentInChildren<VenusThermosphereEffects>(true);
|
|
if (venusThermo != null) venusThermo.thermosphereLevel = (1f - value) * 15f;
|
|
var marsAtmo3 = atmo.GetComponentInChildren<MarsAtmosphereSystem>(true);
|
|
if (marsAtmo3 != null) marsAtmo3.SetLayerIntensity("Layer_Thermosphere", value);
|
|
var marsThermo = atmo.GetComponentInChildren<MarsThermosphereEffects>(true);
|
|
if (marsThermo != null) marsThermo.thermosphereLevel = value;
|
|
var marsDeath2 = GameManager.Instance.GetCurrentPlanet()
|
|
.planetTransform?.GetComponent<MarsDeath>();
|
|
if (marsDeath2 != null) marsDeath2.thermosphereLevel = value;
|
|
var jupiterAtmo2 = atmo.GetComponentInChildren<JupiterAtmosphereSystem>(true);
|
|
if (jupiterAtmo2 != null) jupiterAtmo2.SetLayerIntensity("Layer_Thermosphere", value);
|
|
var jupiterThermo2 = atmo.GetComponentInChildren<JupiterThermosphereEffects>(true);
|
|
if (jupiterThermo2 != null) jupiterThermo2.thermosphereLevel = value;
|
|
var jupiterDeath2 = GameManager.Instance.GetCurrentPlanet()
|
|
.planetTransform?.GetComponent<JupiterDeath>();
|
|
if (jupiterDeath2 != null) jupiterDeath2.thermosphereLevel = value;
|
|
var saturnAtmo2 = atmo.GetComponentInChildren<SaturnAtmosphereSystem>(true);
|
|
if (saturnAtmo2 != null) saturnAtmo2.SetLayerIntensity("Layer_Thermosphere", value);
|
|
var saturnThermo2 = atmo.GetComponentInChildren<SaturnThermosphereEffects>(true);
|
|
if (saturnThermo2 != null) saturnThermo2.thermosphereLevel = value;
|
|
var saturnDeath2 = GameManager.Instance.GetCurrentPlanet()
|
|
.planetTransform?.GetComponent<SaturnDeath>();
|
|
if (saturnDeath2 != null) saturnDeath2.thermosphereLevel = value;
|
|
var uranusAtmo2 = atmo.GetComponentInChildren<UranusAtmosphereSystem>(true);
|
|
if (uranusAtmo2 != null) uranusAtmo2.SetLayerIntensity("Layer_Thermosphere", value);
|
|
var uranusThermo2 = atmo.GetComponentInChildren<UranusThermosphereEffects>(true);
|
|
if (uranusThermo2 != null) uranusThermo2.thermosphereLevel = value;
|
|
var uranusDeath2 = GameManager.Instance.GetCurrentPlanet()
|
|
.planetTransform?.GetComponent<UranusDeath>();
|
|
if (uranusDeath2 != null) uranusDeath2.thermosphereLevel = value;
|
|
var neptuneAtmo2 = atmo.GetComponentInChildren<NeptuneAtmosphereSystem>(true);
|
|
if (neptuneAtmo2 != null) neptuneAtmo2.SetLayerIntensity("Layer_Thermosphere", value);
|
|
var neptuneThermo2 = atmo.GetComponentInChildren<NeptuneThermosphereEffects>(true);
|
|
if (neptuneThermo2 != null) neptuneThermo2.thermosphereLevel = value;
|
|
var neptuneDeath2 = GameManager.Instance.GetCurrentPlanet()
|
|
.planetTransform?.GetComponent<NeptuneDeath>();
|
|
if (neptuneDeath2 != null) neptuneDeath2.thermosphereLevel = value;
|
|
break;
|
|
|
|
case 3:
|
|
pd.thermosphereLevel = value;
|
|
var thermo = atmo.GetComponentInChildren<ThermosphereEffects>(true);
|
|
if (thermo != null) thermo.thermosphereLevel = value;
|
|
var venusExo = atmo.GetComponentInChildren<VenusExosphereEffects>(true);
|
|
if (venusExo != null) venusExo.exosphereLevel = value;
|
|
var venusAtmo4 = atmo.GetComponentInChildren<VenusAtmosphereSystem>(true);
|
|
if (venusAtmo4 != null) venusAtmo4.SetLayerIntensity("Layer_Exosphere", value);
|
|
var marsAtmo4 = atmo.GetComponentInChildren<MarsAtmosphereSystem>(true);
|
|
if (marsAtmo4 != null) marsAtmo4.SetLayerIntensity("Layer_Exosphere", value);
|
|
var marsExo = atmo.GetComponentInChildren<MarsExosphereEffects>(true);
|
|
if (marsExo != null)
|
|
{
|
|
if (!marsExo.enabled)
|
|
{
|
|
marsExo.enabled = true;
|
|
marsExo.InitState();
|
|
}
|
|
marsExo.exosphereLevel = value;
|
|
}
|
|
var marsDeathExo = GameManager.Instance.GetCurrentPlanet()
|
|
.planetTransform?.GetComponent<MarsDeath>();
|
|
if (marsDeathExo != null)
|
|
{
|
|
if (value <= 0f) marsDeathExo.mesosphereLevel = 0f;
|
|
else marsDeathExo.ResetTexture();
|
|
}
|
|
var jupiterAtmo3 = atmo.GetComponentInChildren<JupiterAtmosphereSystem>(true);
|
|
if (jupiterAtmo3 != null) jupiterAtmo3.SetLayerIntensity("Layer_Exosphere", value);
|
|
var jupiterExo3 = atmo.GetComponentInChildren<JupiterExosphereEffects>(true);
|
|
if (jupiterExo3 != null) jupiterExo3.exosphereLevel = value;
|
|
var jupiterDeath3 = GameManager.Instance.GetCurrentPlanet()
|
|
.planetTransform?.GetComponent<JupiterDeath>();
|
|
if (jupiterDeath3 != null) jupiterDeath3.exosphereLevel = value;
|
|
var saturnAtmo3 = atmo.GetComponentInChildren<SaturnAtmosphereSystem>(true);
|
|
if (saturnAtmo3 != null) saturnAtmo3.SetLayerIntensity("Layer_Exosphere", value);
|
|
var saturnExo3 = atmo.GetComponentInChildren<SaturnExosphereEffects>(true);
|
|
if (saturnExo3 != null) saturnExo3.exosphereLevel = value;
|
|
var saturnDeath3 = GameManager.Instance.GetCurrentPlanet()
|
|
.planetTransform?.GetComponent<SaturnDeath>();
|
|
if (saturnDeath3 != null) saturnDeath3.exosphereLevel = value;
|
|
break;
|
|
|
|
case 4:
|
|
pd.exosphereLevel = value;
|
|
break;
|
|
}
|
|
}
|
|
|
|
void UpdateUI()
|
|
{
|
|
if (currentPlanetInfo?.layers == null) return;
|
|
if (currentLayerIndex >= currentPlanetInfo.layers.Length) return;
|
|
|
|
var layer = currentPlanetInfo.layers[currentLayerIndex];
|
|
|
|
if (layerNameText != null)
|
|
layerNameText.text = layer.name;
|
|
|
|
if (layerInfoText != null)
|
|
layerInfoText.text = layer.description;
|
|
|
|
if (percentageText != null)
|
|
percentageText.text = "³äñîòêè: 100%";
|
|
}
|
|
}
|