public void Start()
 {
     if (this.source == null)
     {
         this.source = this.gameObject.GetComponentInChildren <SpriteController>();
     }
     this.BuildImages();
 }
        public void Update()
        {
            bool ready = (this.matchChanges && this.source.frameChanged) || (!this.matchChanges && Time.Get() > this.nextSpawn);

            if (ready && this.active)
            {
                SpriteController sprite = this.sprites[this.nextIndex];
                sprite.transform.position   = this.source.transform.position;
                sprite.transform.rotation   = this.source.transform.rotation;
                sprite.transform.localScale = this.source.transform.localScale;
                sprite.transform.Translate(new Vector3(0, 0, -1));
                sprite.gameObject.SetActive(true);
                sprite.spriteAnimation = this.source.spriteAnimation;
                sprite.Load();
                sprite.instance.SetFrame((int)this.source.frame);
                sprite.spriteActive = sprite.instance.active = false;
                sprite.UpdateFrame();
                if (this.randomColors)
                {
                    sprite.gameObject.GetComponent <Renderer>().material.SetColor("lerpColor", Color.red.Random(this.randomIntensity));
                }
                this.nextDeath[this.nextIndex] = Time.Get() + this.lifetime;
                this.nextSpawn = Time.Get() + this.delay;
                this.nextIndex = (this.nextIndex + 1) % this.sprites.Length;
            }
            for (int index = 0; index < this.sprites.Length; ++index)
            {
                SpriteController sprite = this.sprites[index];
                if (sprite.gameObject.activeSelf)
                {
                    float deathTime  = this.nextDeath[index];
                    float createTime = deathTime - this.lifetime;
                    float progress   = (Time.Get() - createTime) / (deathTime - createTime);
                    if (!this.randomColors)
                    {
                        Color startColor = this.startColor[index % this.startColor.Length];
                        Color endColor   = this.endColor[index % this.endColor.Length];
                        Color mixColor   = Color.Lerp(startColor, endColor, progress);
                        sprite.gameObject.GetComponent <Renderer>().material.SetColor("lerpColor", mixColor);
                    }
                    float mixAlpha = new Bezier(this.startAlpha, this.endAlpha).Curve(progress);
                    sprite.gameObject.GetComponent <Renderer>().material.SetFloat("alpha", mixAlpha);
                    if (Time.Get() > deathTime)
                    {
                        sprite.gameObject.SetActive(false);
                    }
                }
            }
        }