// Add new state from state public static void Add (PlaygroundParticlesC playgroundParticles, ParticleStateC state) { playgroundParticles.states.Add(state); state.Initialize(); }
// Lerp to state object public static void Lerp (PlaygroundParticlesC playgroundParticles, ParticleStateC state, float time, LERPTYPEC lerpType) { if(time<0) time = 0f; Color color = new Color(); for (int i = 0; i<playgroundParticles.particleCache.particles.Length; i++) { if (lerpType==LERPTYPEC.PositionColor||lerpType==LERPTYPEC.Position) playgroundParticles.particleCache.particles[i].position = Vector3.Lerp(playgroundParticles.particleCache.particles[i].position, state.GetPosition(i%state.positionLength), time); if (lerpType==LERPTYPEC.PositionColor||lerpType==LERPTYPEC.Color) { color = state.GetColor(i%state.colorLength); playgroundParticles.particleCache.particles[i].color = Color.Lerp(playgroundParticles.particleCache.particles[i].color, color, time); } } }
// Linear interpolation to state public static void Lerp (PlaygroundParticlesC playgroundParticles, ParticleStateC state, float time) { PlaygroundParticlesC.Lerp(playgroundParticles,state,time,LERPTYPEC.PositionColor); }
// Add single state public static void Add (PlaygroundParticlesC playgroundParticles, ParticleStateC state) { PlaygroundParticlesC.Add(playgroundParticles,state); }
// Return a copy of this ParticleState public ParticleStateC Clone () { ParticleStateC particleState = new ParticleStateC(); particleState.color = new Color32[this.color.Length]; particleState.position = new Vector3[this.position.Length]; particleState.normals = new Vector3[this.normals.Length]; particleState.color = this.color.Clone() as Color32[]; particleState.position = this.position.Clone() as Vector3[]; particleState.normals = this.normals.Clone() as Vector3[]; particleState.stateName = this.stateName; particleState.stateScale = this.stateScale; particleState.stateTexture = this.stateTexture; particleState.stateDepthmap = this.stateDepthmap; particleState.stateDepthmapStrength = this.stateDepthmapStrength; particleState.stateMesh = this.stateMesh; particleState.stateOffset = this.stateOffset; particleState.colorLength = this.colorLength; particleState.positionLength = this.positionLength; particleState.stateTransform = this.stateTransform; return particleState; }