static void setColor(ParticleSystem particle, LootboxRarityColors colors) { var col = particle.colorOverLifetime; col.enabled = true; Gradient grad = new Gradient(); grad.SetKeys( new GradientColorKey[] { new GradientColorKey(colors.color1, 0.0f), new GradientColorKey(colors.color2, 0.544f) }, new GradientAlphaKey[] { new GradientAlphaKey(0.0f, 0.0f), new GradientAlphaKey(0.53125f, 0.109f), new GradientAlphaKey(0.0f, 1.0f) }); col.color = grad; }
// Update is called once per frame void Update() { mod = Mathf.Clamp01(mod); addMod = Mathf.Clamp01(addMod); door.transform.localRotation = Quaternion.Euler(0, mod * maxRotation + addMod * maxAddModRotation, 0); currentColor = LootboxRarityColors_Store.getRarity(currentRarity); setColor(particle1, currentColor); setColor(particle2, currentColor); setOpacity(particle1, mod); setOpacity(particle2, mod); // whitescreenImage.color = new Color(1, 1, 1, addMod * addMod); }