Example #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);
        }
Example #2
0
        private IEnumerator PlaySmallSmokeRoutine(GameObject parentObj, float px, float py, int duration,
                                                  int depthIndex)
        {
            if (depthIndex < 0)
            {
                parentObj.AddChild(_smallBlackSmoke00);
            }
            else
            {
                parentObj.AddChildAt(_smallBlackSmoke00, depthIndex);
            }

            _smallBlackSmoke00.visible = true;
            _smallBlackSmoke00.SetXY(px, py);

            _smallBlackSmoke00.alpha = 1;

            float time = 0;

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

                _smallBlackSmoke00.alpha = 1 - Easing.Ease(Easing.Equation.CubicEaseIn, time, 0, 1, duration);

                _smallBlackSmoke00.SetFrame(frame);

                time += Time.deltaTime;
                yield return(null);
            }

            _smallBlackSmoke00.visible = false;
            parentObj?.RemoveChild(_smallBlackSmoke00);
        }
Example #3
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;
        }
Example #4
0
        private IEnumerator PlayCoinsExplosionRoutine(GameObject target, float offSetX, float offSetY)
        {
            int time     = 0;
            int duration = 1200;

            yield return(null);

            _cartoonCoinsExplosion.SetActive(true);
            target.AddChild(_cartoonCoinsExplosion);
            _cartoonCoinsExplosion.SetXY(0 + offSetX, 0 + offSetY);
            _cartoonCoinsExplosion.alpha = 1f;

            DrawableTweener.TweenSpriteAlpha(_cartoonCoinsExplosion, 1, 0, duration - 500, Easing.Equation.QuadEaseOut,
                                             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));

            target.RemoveChild(_cartoonCoinsExplosion);
            _cartoonCoinsExplosion.SetActive(false);
        }
Example #5
0
 UICanvas()
 {
     healthBarSpriteSheet = new AnimationSprite("HealthSpriteSheet.png", 1, 3);
     healthBarSpriteSheet.SetXY(game.width - 250, 50);
     AddChild(healthBarSpriteSheet);
     uiEasyDraw = new EasyDraw(150, 60);
     AddChild(uiEasyDraw);
 }
Example #6
0
        public Tutorial01Screen() : base("data/Tutorial 01 screen.png")
        {
            _controllerFlapAnim = new AnimationSprite("data/pressdown wings spritesheet.png", 2, 1, -1, false, false);
            AddChild(_controllerFlapAnim);
            _controllerFlapAnim.SetXY(112, 238);

            _controllerOneAnim = new AnimationSprite("data/pressonedown.png", 2, 1, -1, false, false);
            AddChild(_controllerOneAnim);
            _controllerOneAnim.SetXY(931, 570);

            _storkFlapAnim = new AnimationSprite("data/spritesheet flapdown.png", 2, 1, -1, false, false);
            AddChild(_storkFlapAnim);
            _storkFlapAnim.SetXY(539, 48);
            _storkFlapAnim.Turn(10);

            _storkOneAnim = new AnimationSprite("data/spritesheet flaponedown.png", 2, 1, -1, false, false);
            AddChild(_storkOneAnim);
            _storkOneAnim.SetXY(1361, 462);
            _storkOneAnim.Turn(8);

            CoroutineManager.StartCoroutine(AnimateWings(), this);
        }
Example #7
0
        private void drawScreen()
        {
            //Background
            AnimationSprite background = new AnimationSprite("endscreenbg.png", 1, 2);
            AddChild(background);

            //Draw credits
            _credits = new Sprite("credits.png");
            AddChild(_credits);
            _credits.y = game.height;

            //Draw borders
            Sprite borders = new Sprite("endscreenborders.png");
            AddChild(borders);

            //Draw YOUWON or YOULOST
            AnimationSprite wonlost = new AnimationSprite("wonlost.png", 1, 2);
            wonlost.SetOrigin(wonlost.width / 2, wonlost.height / 2);
            wonlost.SetXY(_game.width / 2, 100);
            AddChild(wonlost);

            //Check if player has won or lost
            if (CurrentWonTest == LevelTest.Won)
            {
                background.SetFrame((int)CurrentWonTest);
                wonlost.SetFrame((int)CurrentWonTest);
            }
            else if (CurrentWonTest == LevelTest.Lost)
            {
                background.SetFrame((int)CurrentWonTest);
                wonlost.SetFrame((int)CurrentWonTest);
            }

            //Draw "Throw in a coin to play again"
            _insertcoin = new Sprite("insertcoin.png");
            AddChild(_insertcoin);
            _insertcoin.SetOrigin(_insertcoin.width / 2, _insertcoin.height / 2);
            _insertcoin.SetXY(game.width / 2, game.height - _insertcoin.height);
        }
Example #8
0
File: Menu.cs Project: mbos14/GTFO
        private void drawSecond()
        {
            if (_coinInserted && !_secondDrewn)
            {
                menuBG.Destroy();
                _text.Destroy();

                Sprite background = new Sprite("buttonmenu.png");
                AddChild(background);

                _text = new AnimationSprite("text.png", 1, 4);
                AddChild(_text);
                _text.SetFrame(1);
                _text.SetXY(game.width / 2 - 390 , game.height - 60);
                _secondDrewn = true;
            }
        }
Example #9
0
File: Menu.cs Project: mbos14/GTFO
        private void drawNormal()
        {
            AddChild(menuBG);

            _text = new AnimationSprite("text.png", 1, 4);
            AddChild(_text);
            _text.SetOrigin(_text.width / 2, _text.height / 2);
            _text.SetXY(game.width / 2 + 230, game.height - 150);
            _text.SetFrame(2);
        }