示例#1
0
    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);
    }
示例#3
0
 public ref float GetStatePtr(ParticleStateField field, int particleIdx)
 {
     return(ref _memory.Span[_capacity * (int)field + particleIdx]);
 }
示例#4
0
 public float GetState(ParticleStateField field, int particleIdx)
 {
     return(GetStatePtr(field, particleIdx));
 }
示例#5
0
 public void SetState(ParticleStateField field, int particleIdx, float value)
 {
     GetStatePtr(field, particleIdx) = value;
 }