/// <summary> /// Adds a single state. /// </summary> /// <param name="playgroundParticles">Playground particles.</param> /// <param name="state">State.</param> public static void Add (PlaygroundParticlesC playgroundParticles, ParticleStateC state) { PlaygroundParticlesC.Add(playgroundParticles,state); }
/// <summary> /// Returns a copy of this ParticleState. /// </summary> public ParticleStateC Clone () { ParticleStateC particleState = new ParticleStateC(); particleState.stateName = stateName; particleState.stateScale = stateScale; particleState.stateTexture = stateTexture; particleState.stateDepthmap = stateDepthmap; particleState.stateDepthmapStrength = stateDepthmapStrength; particleState.stateMesh = stateMesh; particleState.stateOffset = stateOffset; particleState.colorLength = colorLength; particleState.positionLength = positionLength; particleState.stateTransform = stateTransform; particleState.applyChromaKey = applyChromaKey; particleState.chromaKey = chromaKey; particleState.chromaKeySpread = chromaKeySpread; return particleState; }
// 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.Length; i++) { if (lerpType==LERPTYPEC.PositionColor||lerpType==LERPTYPEC.Position) playgroundParticles.particleCache[i].position = Vector3.Lerp(playgroundParticles.particleCache[i].position, state.GetPosition(i%state.positionLength), time); if (lerpType==LERPTYPEC.PositionColor||lerpType==LERPTYPEC.Color) { color = state.GetColor(i%state.colorLength); playgroundParticles.particleCache[i].color = Color.Lerp(playgroundParticles.particleCache[i].color, color, time); } } }
// Add new state from state public static void Add(PlaygroundParticlesC playgroundParticles, ParticleStateC state) { playgroundParticles.states.Add(state); state.Initialize(); }
// Linear interpolation to state public static void Lerp (PlaygroundParticlesC playgroundParticles, ParticleStateC state, float time) { PlaygroundParticlesC.Lerp(playgroundParticles,state,time,LERPTYPEC.PositionColor); }