コード例 #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);
        }
コード例 #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);
        }
コード例 #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;
        }
コード例 #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);
        }
コード例 #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));
            }
        }
コード例 #6
0
ファイル: Ground.cs プロジェクト: Matioma/Pitfall-1982
        public Ground()
        {
            _visuals = new AnimationSprite("Tiles.png", 5, 1);
            _visuals.SetFrame(0);

            _hitBox = new HitBox();
            AddChild(_visuals);
            AddChild(_hitBox);
        }
コード例 #7
0
ファイル: Endscreen.cs プロジェクト: mbos14/GTFO
        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);
        }
コード例 #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;
            }
        }
コード例 #9
0
ファイル: NPC.cs プロジェクト: Jessebeau2001/FinalApproach
        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)})");
        }
コード例 #10
0
ファイル: Menu.cs プロジェクト: 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;
            }
        }
コード例 #11
0
ファイル: Menu.cs プロジェクト: 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);
        }
コード例 #12
0
ファイル: UICanvas.cs プロジェクト: Matioma/Pitfall-1982
 public void UpdateHealth(int health)
 {
     _currentHP = health;
     healthBarSpriteSheet.SetFrame(healthBarSpriteSheet.frameCount - health);
 }