private void Start() { Dungeon m_dungeonPrefab = DungeonDatabase.GetOrLoadByName("finalscenario_guide"); DungeonFlow dungeonFlowPrefab = m_dungeonPrefab.PatternSettings.flows[0]; PrototypeDungeonRoom GuidePastRoom = dungeonFlowPrefab.AllNodes[0].overrideExactRoom; GameObject GuidePastRoomObject = GuidePastRoom.placedObjects[0].nonenemyBehaviour.gameObject; GameObject m_RainPrefab = GuidePastRoomObject.transform.Find("Rain").gameObject; GameObject m_ThunderStorm = Instantiate(m_RainPrefab); m_ThunderStorm.name = "ExpandRain"; m_StormController = m_ThunderStorm.GetComponent <ThunderstormController>(); ParticleSystem m_CachedParticleSystem = m_StormController.RainSystemTransform.GetComponent <ParticleSystem>(); if (useCustomIntensity) { BraveUtility.SetEmissionRate(m_CachedParticleSystem, RainIntensity); } m_StormController.DecayVertical = isLocalToRoom; m_StormController.DoLighting = false; LightningRenderers = m_StormController.LightningRenderers; m_ThunderStorm.transform.parent = gameObject.transform; dungeonFlowPrefab = null; m_dungeonPrefab = null; isActive = true; }
private void InitStorm() { Dungeon m_dungeonPrefab = DungeonDatabase.GetOrLoadByName("finalscenario_guide"); DungeonFlow dungeonFlowPrefab = m_dungeonPrefab.PatternSettings.flows[0]; PrototypeDungeonRoom GuidePastRoom = dungeonFlowPrefab.AllNodes[0].overrideExactRoom; GameObject GuidePastRoomObject = GuidePastRoom.placedObjects[0].nonenemyBehaviour.gameObject; GameObject m_RainPrefab = GuidePastRoomObject.transform.Find("Rain").gameObject; m_ThunderStorm = Instantiate(m_RainPrefab); m_ThunderStorm.name = "ChaosRain"; ThunderstormController stormController = m_ThunderStorm.GetComponent <ThunderstormController>(); ParticleSystem m_CachedParticleSystem = stormController.RainSystemTransform.GetComponent <ParticleSystem>(); if (useCustomIntensity) { BraveUtility.SetEmissionRate(m_CachedParticleSystem, RainIntensity); } m_cachedEmissionRate = m_CachedParticleSystem.emission.rate.constant; stormController.DecayVertical = false; stormController.DoLighting = false; m_ChaosLightning = new GameObject("ChaosLightning"); m_ChaosLightning.AddComponent <ChaosWeatherController>(); ChaosWeatherController LightningComponent = m_ChaosLightning.GetComponent <ChaosWeatherController>(); LightningComponent.LightningRenderers = stormController.LightningRenderers; dungeonFlowPrefab = null; m_dungeonPrefab = null; }
private IEnumerator ToggleRainFX(PlayerController player, float cachedRate) { if (GameObject.Find("Base_ResourcefulRat(Clone)") == null) { yield break; } if (GameObject.Find("ChaosRain") == null) { yield break; } if (GameObject.Find("ChaosLightning") == null) { yield break; } ThunderstormController stormController = GameObject.Find("ChaosRain").GetComponent <ThunderstormController>(); ParticleSystem m_CachedParticleSystem = stormController.RainSystemTransform.GetComponent <ParticleSystem>(); ChaosWeatherController LightningController = GameObject.Find("ChaosLightning").GetComponent <ChaosWeatherController>(); bool Active = true; if (ChaosLists.InvalidRatFloorRainRooms.Contains(player.CurrentRoom.GetRoomName()) | player.CurrentRoom.IsShop | player.CurrentRoom.area.PrototypeRoomCategory == PrototypeDungeonRoom.RoomCategory.BOSS) { Active = false; } if (!Active) { if (!stormController.enabled && !LightningController.isActive) { yield break; } AkSoundEngine.PostEvent("Stop_ENV_rain_loop_01", stormController.gameObject); BraveUtility.SetEmissionRate(m_CachedParticleSystem, 0f); yield return(new WaitForSeconds(2f)); stormController.enabled = false; LightningController.isActive = false; yield return(null); yield break; } else { if (stormController.enabled && LightningController.isActive) { yield break; } BraveUtility.SetEmissionRate(m_CachedParticleSystem, cachedRate); stormController.enabled = true; LightningController.isActive = true; yield return(null); yield break; } }
private IEnumerator ToggleRainFX(PlayerController player, float cachedRate) { if (!m_StormController) { yield break; } bool Active = true; if (ExpandLists.InvalidRatFloorRainRooms.Contains(player.CurrentRoom.GetRoomName()) | player.CurrentRoom.IsShop | player.CurrentRoom.area.PrototypeRoomCategory == PrototypeDungeonRoom.RoomCategory.BOSS) { Active = false; } yield return(null); if (!Active) { if (!m_StormController.enabled && !isActive) { yield break; } AkSoundEngine.PostEvent("Stop_ENV_rain_loop_01", m_StormController.gameObject); BraveUtility.SetEmissionRate(m_StormController.RainSystemTransform.GetComponent <ParticleSystem>(), 0f); yield return(new WaitForSeconds(2f)); m_StormController.enabled = false; isActive = false; yield return(null); yield break; } else { if (m_StormController.enabled && isActive) { yield break; } BraveUtility.SetEmissionRate(m_StormController.RainSystemTransform.GetComponent <ParticleSystem>(), cachedRate); m_StormController.enabled = true; isActive = true; yield break; } }
public static void AddRainStormToFloor(string dungeon, float RainIntensity = 1f, bool useCustomIntensity = false) { if (string.IsNullOrEmpty(dungeon)) { return; } GameObject dungeonObject = GameObject.Find(dungeon); if (dungeonObject == null) { dungeonObject = GameObject.Find(dungeon + "(Clone)"); } if (dungeonObject == null) { return; } Dungeon m_dungeonPrefab = DungeonDatabase.GetOrLoadByName("finalscenario_guide"); DungeonFlow dungeonFlowPrefab = m_dungeonPrefab.PatternSettings.flows[0]; PrototypeDungeonRoom GuidePastRoom = dungeonFlowPrefab.AllNodes[0].overrideExactRoom; GameObject GuidePastRoomObject = GuidePastRoom.placedObjects[0].nonenemyBehaviour.gameObject; GameObject m_RainPrefab = GuidePastRoomObject.transform.Find("Rain").gameObject; GameObject m_ThunderStorm = Instantiate(m_RainPrefab); m_ThunderStorm.name = "ChaosRain"; ThunderstormController stormController = m_ThunderStorm.GetComponent <ThunderstormController>(); ParticleSystem m_CachedParticleSystem = stormController.RainSystemTransform.GetComponent <ParticleSystem>(); if (useCustomIntensity) { BraveUtility.SetEmissionRate(m_CachedParticleSystem, RainIntensity); } stormController.DecayVertical = false; stormController.DoLighting = false; GameObject m_ChaosLightning = new GameObject("ChaosLightning"); m_ChaosLightning.name = "ChaosLightning"; m_ChaosLightning.AddComponent <ChaosWeatherController>(); ChaosWeatherController LightningComponent = m_ChaosLightning.GetComponent <ChaosWeatherController>(); LightningComponent.LightningRenderers = stormController.LightningRenderers; dungeonFlowPrefab = null; m_dungeonPrefab = null; return; }
private IEnumerator ToggleRainFx(bool Active) { if (m_ChaosLightning == null | m_ThunderStorm == null) { yield break; } if (!Active) { m_StormIsActive = false; ChaosWeatherController CurrentWeather = m_ChaosLightning.GetComponent <ChaosWeatherController>(); CurrentWeather.isActive = false; ThunderstormController m_ThunderStormComponent = m_ThunderStorm.GetComponent <ThunderstormController>(); AkSoundEngine.PostEvent("Stop_ENV_rain_loop_01", m_ThunderStormComponent.gameObject); ParticleSystem rainParticles = m_ThunderStormComponent.RainSystemTransform.GetComponent <ParticleSystem>(); BraveUtility.SetEmissionRate(rainParticles, 0f); yield return(new WaitForSeconds(2f)); m_ThunderStormComponent.enabled = false; m_ThunderStorm.SetActive(false); yield return(null); yield break; } else { m_ThunderStorm.SetActive(true); yield return(null); ThunderstormController m_ThunderStormComponent = m_ThunderStorm.GetComponent <ThunderstormController>(); m_ThunderStormComponent.enabled = true; ParticleSystem rainParticles = m_ThunderStormComponent.RainSystemTransform.GetComponent <ParticleSystem>(); BraveUtility.SetEmissionRate(rainParticles, m_cachedEmissionRate); ChaosWeatherController CurrentWeather = m_ChaosLightning.GetComponent <ChaosWeatherController>(); CurrentWeather.isActive = true; m_StormIsActive = true; yield break; } }