示例#1
0
//      public override void Awake ()
//      {
// #if UNITY_EDITOR
//          if (!Application.isPlaying)
//              return;
// #endif
//          base.Awake ();
//      }

        public virtual void OnEnable()
        {
#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                return;
            }
#endif
            generateRandomGradient = colorGradient2D.xGradients.Length == 0;
            if (generateRandomGradient)
            {
                colorGradient2D = ColorGradient2D.GenerateRandom(colorKeys.x, alphaKeys.x, colorKeys.y, alphaKeys.y);
            }
            colorGradient2DRenderer.material.mainTexture = colorGradient2D.MakeSprite(textureSize, pixelsPerUnit).texture;
        }
 public virtual void GenerateRandom()
 {
     colorGradient = ColorGradient2D.GenerateRandom(colorBoundaryCount, distanceMultiplier, strengthRange, lengthRange, chanceOfUsingPreviousStrength, chanceOfUsingPreviousLength, chanceOfUsingPreviousColor, chanceOfUsingPreviousPosition, chanceOfUsingPreviousRotation);
 }