Example #1
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 #2
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 #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
        private IEnumerator AnimateWings()
        {
            while (Destroyed == false)
            {
                _controllerFlapAnim.SetFrame(0);
                _controllerOneAnim.SetFrame(0);
                _storkFlapAnim.SetFrame(0);
                _storkOneAnim.SetFrame(0);
                yield return(new WaitForMilliSeconds(200));

                _controllerFlapAnim.SetFrame(1);
                _controllerOneAnim.SetFrame(1);
                _storkFlapAnim.SetFrame(1);
                _storkOneAnim.SetFrame(1);
                yield return(new WaitForMilliSeconds(900));
            }
        }
Example #6
0
        public Ground()
        {
            _visuals = new AnimationSprite("Tiles.png", 5, 1);
            _visuals.SetFrame(0);

            _hitBox = new HitBox();
            AddChild(_visuals);
            AddChild(_hitBox);
        }
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
        private void AnimationHandeler()
        {
            switch (animState)
            {
            case "v":
                playerSprite.SetFrame(0);
                break;

            case "<":
                playerSprite.SetFrame(2);
                playerSprite.Mirror(false, false);
                break;

            case ">":
                playerSprite.SetFrame(2);
                playerSprite.Mirror(true, false);
                break;

            case "^":
                playerSprite.SetFrame(1);
                break;
            }
        }
Example #9
0
        void SetAnimState()
        {
            if (Mathf.Abs(_force.x) > Mathf.Abs(_force.y))
            {
                switch (Mathf.Sign(_force.x))
                {
                case 1:
                    startFrame = 8;
                    break;

                case -1:
                    startFrame = 12;
                    break;
                }
            }
            else
            {
                switch (Mathf.Sign(_force.y))
                {
                case 1:
                    startFrame = 4;
                    break;

                case -1:
                    startFrame = 0;
                    break;
                }
            }

            if (startFrame != lastStartFrame)
            {
                animSprite.SetFrame(startFrame);
            }
            lastStartFrame = startFrame;
            //Console.WriteLine($"Vec2: {_force} SignX: ({Mathf.Sign(_force.x)}), SignY: ({Mathf.Sign(_force.y)})");
        }
Example #10
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 #11
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);
        }
Example #12
0
 public void UpdateHealth(int health)
 {
     _currentHP = health;
     healthBarSpriteSheet.SetFrame(healthBarSpriteSheet.frameCount - health);
 }