Exemplo n.º 1
0
 void RunPlayerAnimation()
 {
     if (data.PlayerCoinCount > 0 && Elements["instruction2"].Visible && !animationsRun["player"])
     {
         if (data.IsDecider)
         {
             Co.WaitForSeconds(0.5f, () => {
                 AnimElementUI coin = CreateAnimation();
                 coin.SpriteName    = "coin";
                 coin.Text          = "+" + data.PlayerCoinCount.ToString();
                 coin.Size          = new Vector2(100, 100);
                 coin.TextPadding   = new Vector2(-10, 0);
                 coin.Animate(new UIAnimator.Expand(1.5f, () => {
                     Co.WaitForSeconds(1f, () => {
                         coin.Animate(new UIAnimator.Shrink(1.5f, () => {
                             coin.Destroy();
                         }));
                     });
                 }));
             });
         }
         else
         {
             RunCoinAnimation(data.PlayerCoinCount.ToString(), data.PlayerAvatarColor);
         }
         animationsRun["player"] = true;
     }
 }
Exemplo n.º 2
0
    public void RunCoinToAvatarAnimation(string coinCount, string avatarColor)
    {
        // Introduce the coin
        AnimElementUI coin = CreateAnimation();

        coin.SpriteName    = "coin";
        coin.Text          = "+" + coinCount;
        coin.Size          = new Vector2(50, 50);
        coin.LocalPosition = new Vector3(-50, 25, 0);
        coin.TextPadding   = new Vector2(-10, 0);
        coin.Animate(new UIAnimator.Expand(0.5f));

        Co.WaitForSeconds(1f, () => {
            // Introduce the avatar
            Vector3 avatarPosition = new Vector3(50, 25f, 0);
            AnimElementUI avatar   = CreateAnimation();
            avatar.AvatarName      = avatarColor;
            avatar.Size            = new Vector2(75, 75);
            avatar.LocalPosition   = avatarPosition;
            avatar.Animate(new UIAnimator.Expand(0.5f));

            Co.WaitForSeconds(1f, () => {
                // Move the coin to the avatar and shrink out
                coin.Animate(new UIAnimator.Move(1f, avatarPosition, () => {
                    coin.Destroy();
                    avatar.Animate(new UIAnimator.Shrink(0.5f, () => {
                        avatar.Destroy();
                    }));
                }));
            });
        });
    }
Exemplo n.º 3
0
        void RunWinnerAnimation()
        {
            if (Elements["instruction3"].Visible && !animationsRun["winner"])
            {
                Co.WaitForSeconds(0.5f, () => {
                    AnimElementUI trophy = CreateAnimation();
                    trophy.SpriteName    = "trophy";
                    trophy.Size          = new Vector2(100, 100);
                    trophy.Animate(new UIAnimator.Expand(1f));
                    trophy.Animate(new UIAnimator.Spin(1f));

                    Co.WaitForSeconds(3.5f, () => {
                        trophy.Animate(new UIAnimator.Spin(1f));
                        trophy.Animate(new UIAnimator.Shrink(1f, () => {
                            trophy.Destroy();
                        }));
                    });
                });

                animationsRun["winner"] = true;
            }
        }