Exemple #1
0
        private IEnumerator PlayCoinsExplosionRoutine(Stork stork)
        {
            int time     = 0;
            int duration = 1200;

            yield return(null);

            _cartoonCoinsExplosion.SetActive(true);
            stork.AddChild(_cartoonCoinsExplosion);
            _cartoonCoinsExplosion.SetXY(0, 0);
            _cartoonCoinsExplosion.alpha = 1f;

            SpriteTweener.TweenAlpha(_cartoonCoinsExplosion, 1, 0, duration - 500, null, 500);

            while (time < duration)
            {
                float fFrame = Mathf.Map(time, 0, duration, 0, _cartoonCoinsExplosion.frameCount - 1);
                int   frame  = Mathf.Round(fFrame) % _cartoonCoinsExplosion.frameCount;

                _cartoonCoinsExplosion.SetFrame(frame);

                time += Time.deltaTime;

                yield return(null);
            }

            yield return(new WaitForMilliSeconds(200));

            stork.RemoveChild(_cartoonCoinsExplosion);
            _cartoonCoinsExplosion.SetActive(false);
        }
Exemple #2
0
        private IEnumerator ShowSmokeOnStork00Routine(Stork stork)
        {
            int time     = 0;
            int duration = 1500;

            yield return(null);

            _smoke00.visible = true;
            stork.AddChild(_smoke00);
            _smoke00.SetXY(0, 0);
            _smoke00.alpha = 1f;

            SpriteTweener.TweenAlpha(_smoke00, 1, 0, duration - 500, null, 500);

            while (time < duration)
            {
                float fFrame = Mathf.Map(time, 0, duration, 0, _smoke00.frameCount - 1);
                int   frame  = Mathf.Round(fFrame) % _smoke00.frameCount;

                _smoke00.SetFrame(frame);

                time += Time.deltaTime;

                yield return(null);
            }

            yield return(new WaitForMilliSeconds(200));

            stork.RemoveChild(_smoke00);
            _smoke00.visible = false;
        }