| . | |
| using System; |
| |
| using UnityEngine; |
| |
| |
| |
| public class OceanBubbleParticles : MonoBehaviour |
| |
| { |
| |
| private void Start() |
| |
| { |
| |
| this.m_particleSystem = base.GetComponent<ParticleSystem>(); |
| |
| } |
| |
| |
| |
| private void Update() |
| |
| { |
| |
| if (this.m_particles == null) |
| |
| { |
| |
| this.m_particles = new ParticleSystem.Particle[this.m_particleSystem.main.maxParticles]; |
| |
| } |
| |
| int particles = this.m_particleSystem.GetParticles(this.m_particles); |
| |
| for (int i = 0; i < particles; i++) |
| |
| { |
| |
| float liquidLevel = Floating.GetLiquidLevel(this.m_particles[i].position, 1f, LiquidType.All); |
| |
| Vector3 position = this.m_particles[i].position; |
| |
| position.y = liquidLevel; |
| |
| this.m_particles[i].position = position; |
| |
| } |
| |
| this.m_particleSystem.SetParticles(this.m_particles); |
| |
| } |
| |
| |
| |
| private ParticleSystem m_particleSystem; |
| |
| |
| |
| private ParticleSystem.Particle[] m_particles; |
| |
| } |
| |
| |