예제 #1
0
 // EVALUATE COLOR//
 //
 override public void Evaluate_Color()
 {
     if (modifyColor.GetValue())
     {
         int particleIndex;
         for (int i = 0; i < ownerBlueprint.ownerEmitter.activeParticleIndices.Length; i++)
         {
             particleIndex = ownerBlueprint.ownerEmitter.activeParticleIndices[i];
             ownerBlueprint.colorStack.values[particleIndex] = color.GetValue(particleIndex);
         }
     }
 }
예제 #2
0
 // EVALUATE //
 //
 // Evaluate when particle specific data is NOT available.
 override public void Evaluate(ref float input)
 {
     input = Blend(input, value.GetValue(), weight.GetValue());
 }
예제 #3
0
        private Texture2D dummyTexture;         // Empty texture asset for drawing EditorGUI.DrawPreviewTexture().
#endif
//============================================================================//

        // GET VALUE //
        //
        // GetValue when particle index is NOT known.
        public Vector4 GetValue()
        {
            Vector4 returnValue    = Vector4.zero;
            Vector4 curveMinResult = Vector4.zero;
            Vector4 curveMaxResult = Vector4.zero;

            System.Random theRandom = new System.Random(ownerBlueprint.ownerEmitter.randomSeed + randomSeed);

#if UNITY_EDITOR
            CheckReferences();
#endif

            switch (dataMode)
            {
            case eDataMode.Constant:
                returnValue = constant;
                break;

            case eDataMode.RandomConstant:
                if (usePerComponentRandom)
                {
                    returnValue.x = Mathf.Lerp(randomMin.x, randomMax.x, (float)theRandom.NextDouble());
                    //Random.seed++;
                    returnValue.y = Mathf.Lerp(randomMin.y, randomMax.y, (float)theRandom.NextDouble());
                    //Random.seed++;
                    returnValue.z = Mathf.Lerp(randomMin.z, randomMax.z, (float)theRandom.NextDouble());
                    //Random.seed++;
                    returnValue.w = Mathf.Lerp(randomMin.w, randomMax.w, (float)theRandom.NextDouble());
                }
                else
                {
                    returnValue = Vector4.Lerp(randomMin, randomMax, (float)theRandom.NextDouble());
                }
                break;

            case eDataMode.Curve:
                returnValue = curve.Evaluate(ownerBlueprint.ownerEmitter);
                break;

            case eDataMode.RandomCurve:
                if (usePerComponentRandom)
                {
                    curveMinResult = curveMin.Evaluate(ownerBlueprint.ownerEmitter);
                    curveMaxResult = curveMax.Evaluate(ownerBlueprint.ownerEmitter);

                    returnValue.x = Mathf.Lerp(curveMinResult.x, curveMaxResult.x, (float)theRandom.NextDouble());
                    //Random.seed++;
                    returnValue.y = Mathf.Lerp(curveMinResult.y, curveMaxResult.y, (float)theRandom.NextDouble());
                    //Random.seed++;
                    returnValue.z = Mathf.Lerp(curveMinResult.z, curveMaxResult.z, (float)theRandom.NextDouble());
                    //Random.seed++;
                    returnValue.w = Mathf.Lerp(curveMinResult.w, curveMaxResult.w, (float)theRandom.NextDouble());
                }
                else
                {
                    returnValue = Vector4.Lerp(curveMin.Evaluate(ownerBlueprint.ownerEmitter), curveMax.Evaluate(ownerBlueprint.ownerEmitter), (float)theRandom.NextDouble());
                }
                break;

            case eDataMode.Reference:
                if (reference != null)
                {
                    ColorProperty theReference = (ColorProperty)reference.property;
                    returnValue = theReference.GetValue();
                }
                break;
            }

            if (coordSystemConversionMode != BaseProperty.eCoordSystemConversionMode.NoConversion)
            {
                returnValue = ConvertCoordinateSystem(returnValue, -1);
            }

            return(returnValue);
        }