public void OnParticleSplat(ParticleCollisionEvent particleCollisionEvent, float size, Gradient colorGradient) { if (decalContainer != null) { Vector3 position = particleCollisionEvent.intersection; Vector3 particleRotationEuler = Quaternion.LookRotation(particleCollisionEvent.normal).eulerAngles; particleRotationEuler.z = Random.Range(0, 360); Color color = colorGradient.Evaluate(Random.Range(0f, 1f)); decalContainer.AddDecal(position, size, particleRotationEuler, color); } }
public static void SplatOnGlobal(ParticleCollisionEvent particleCollisionEvent, float size, Gradient colorGradient) { DecalContainer global = GameController.Instance.gameObject.GetComponent <DecalContainer> (); if (global != null) { Vector3 position = particleCollisionEvent.intersection; Vector3 particleRotationEuler = Quaternion.LookRotation(particleCollisionEvent.normal).eulerAngles; particleRotationEuler.z = Random.Range(0, 360); Color color = colorGradient.Evaluate(Random.Range(0f, 1f)); global.AddDecal(position, size, particleRotationEuler, color); } }