void UpdateParameters() { ParticlePlugin.ParticleSystemParameter parm = new ParticlePlugin.ParticleSystemParameter(m_infinite, m_maxParticles, m_lifeTime, m_gravity, m_position, m_velocity, m_startColor, m_endColor, m_startAlpha, m_startSize, m_endSize, m_positionJitter, m_velocityJitter); ParticlePlugin.SetParticleSystemParameters(m_id, parm); }
// Update is called once per frame void Update() { ParticlePlugin.UpdateParticleSystem(m_id, Time.deltaTime); int num = ParticlePlugin.GetParticleNum(m_id); ParticlePlugin.GetParticleData(m_particleDataArray, m_id, num); for (int i = 0; i < m_maxParticleObjects; ++i) { GameObject particle = m_particles[i]; if ((i < num && !m_particleDataArray[i].isAlive) || i >= num) { particle.SetActive(false); } else { particle.SetActive(true); // Set position particle.transform.position = ParticlePlugin.FloatArrayToVector3(m_particleDataArray[i].position); // Set scale float scale = m_particleDataArray[i].scale; particle.transform.localScale = new Vector3(scale, scale, scale); // Set color Vector3 color = ParticlePlugin.FloatArrayToVector3(m_particleDataArray[i].color); float alpha = m_particleDataArray[i].alpha; Material material = particle.GetComponent <Renderer>().material; material.color = new Color(color.x, color.y, color.z, alpha); } } }
public Vector2 m_velocityJitter = new Vector2(-20f, 20f); // min and max // Start is called before the first frame update void Start() { m_id = ParticlePlugin.CreateParticleSystem(); m_particleDataArray = new ParticlePlugin.ParticleData[m_maxParticleObjects]; // Initialize the array // Initialize particle objects for (int i = 0; i < m_maxParticleObjects; i++) { m_particleDataArray[i] = new ParticlePlugin.ParticleData(); GameObject particle = GameObject.Instantiate(m_particlePrefab, this.transform); m_particles.Add(particle); particle.SetActive(false); } UpdateParameters(); }
// TODO: Add support for optinal keys again, for MeshComponent.Key public ParticleProcessor(ParticlePlugin particlePlugin) : base(new PropertyKey[] { ParticleEmitterComponent.Key, TransformationComponent.Key }) { this.particlePlugin = particlePlugin; updaters = new List <ParticleUpdater>(); }
public void Destroy() { ParticlePlugin.RemoveParticleSystem(m_id); Destroy(this.gameObject); }
public bool IsAlive() { return(ParticlePlugin.IsAlive(m_id)); }