void Start() { RainEffect rain = (RainEffect)FindObjectOfType(typeof(RainEffect)); if (rain != null) { rain.RainEnabled(true); } }
private void GenerateExplosion() { int num = random.Next(1, 4); switch (num) { case 1: ExplodeEffect explodeEfect = new ExplodeEffect(this.Location); ParticlesSystem.RegisterEfect(explodeEfect); break; case 2: ExplodeEffectAlt explodeEfectAlt = new ExplodeEffectAlt(this.Location); ParticlesSystem.RegisterEfect(explodeEfectAlt); break; case 3: RainEffect rainEfect = new RainEffect(this.Location); ParticlesSystem.RegisterEfect(rainEfect); break; } }
void OnDisable() { DestroyImmediate(RainMaterial); RainMaterial = null; Instance = null; }
// Start is called before the first frame update private void OnEnable() { RainMaterial = new Material(RainShader ?? Shader.Find("Effect/RainShader")); RainMaterial.hideFlags = HideFlags.DontSave; Instance = this; }