private static byte GetParticleColorComponent(ParticleStateField stateField, PartSysParamId paramId, PartSysEmitter emitter, int particleIdx) { var colorParam = emitter.GetParamState(paramId); byte value; if (colorParam != null) { var partAge = emitter.GetParticleAge(particleIdx); var partColor = colorParam.GetValue(emitter, particleIdx, partAge); partColor += emitter.GetParticleState().GetState(stateField, particleIdx); if (partColor >= 255) { value = 255; } else if (partColor < 0) { value = 0; } else { value = (byte)partColor; } } else { value = (byte)emitter.GetParticleState().GetState(stateField, particleIdx); } return(value); }
private static void SetParticleParam(PartSysEmitter emitter, int particleIdx, PartSysParamId id, float atLifetime, ParticleStateField stateField, float defaultValue) { var value = GetParticleValue(emitter, particleIdx, id, atLifetime, defaultValue); emitter.GetParticleState().SetState(stateField, particleIdx, value); }
public ref float GetStatePtr(ParticleStateField field, int particleIdx) { return(ref _memory.Span[_capacity * (int)field + particleIdx]); }
public float GetState(ParticleStateField field, int particleIdx) { return(GetStatePtr(field, particleIdx)); }
public void SetState(ParticleStateField field, int particleIdx, float value) { GetStatePtr(field, particleIdx) = value; }