public void DecreaseRainState() { switch (rState) { case RainState.off: break; case RainState.soft: rState = RainState.off; break; case RainState.medium: rState = RainState.soft; break; case RainState.heavy: rState = RainState.medium; break; case RainState.thunderStorm: rState = RainState.heavy; break; } Rain(); }
void Update() { switch (currentState) { case RainState.raining: { Rain(); if (rainCountdown <= 0) { notRainingCountDown = Random.Range(randomCountMin, randomCountMax); currentState = RainState.notRaining; } MoveWithPlayer(); break; } case RainState.notRaining: { StopRain(); if (notRainingCountDown <= 0) { rainCountdown = Random.Range(randomCountMin, randomCountMax); currentState = RainState.raining; } break; } } }
public void BeginDrying() { Log.Debug("Beginning drying cycle"); Dry(_raining); State = RainState.Drying; }
private void Start() { player = PlayerManager.instance.player.transform; rainObject = GetComponent <ParticleSystem>(); rainAudioSource = GetComponent <AudioSource>(); //start values for the rain and not rain countdowns rainCountdown = Random.Range(randomCountMin, randomCountMax); notRainingCountDown = Random.Range(randomCountMin, randomCountMax); //start with no rain currentState = RainState.notRaining; }
private void Reset() { Reset(_raining); Reset(_drying); Reset(_retired); Reset(_dead); foreach (var decal in GetComponentsInChildren <WetDecal>()) { DestroyImmediate(decal.gameObject); } State = RainState.Drying; }
public void BeginRaining(float initialProgress = 0) { Log.Debug("Beginning raining cycle"); Retire(_drying); Retire(_raining); var decal = Spawn(); if (decal != null) { decal.Rain(initialProgress); _raining.Add(decal); } State = RainState.Raining; }
public IEnumerator PlayerDeath(float timer, Vector3 playerPosition) { while (timer > 0) { rState = RainState.off; Rain(); globalLightObj.SetActive(false); if (SkullAI.sAI != null) { SkullAI.sAI.gameObject.SetActive(false); } lanternLight.pointLightInnerRadius = Mathf.Lerp(lanternLight.pointLightInnerRadius, 0f, Time.deltaTime * 2f); lanternLight.pointLightOuterRadius = Mathf.Lerp(lanternLight.pointLightOuterRadius, 0f, Time.deltaTime * 2f); timer -= Time.deltaTime; yield return(null); } AudioController.aC.PlaySFXAtPoint(AudioController.aC.playerDeath, playerPosition, 0.4f); yield return(new WaitForSeconds(4f)); GameController.gC.RestartScene(); }