Exemplo n.º 1
0
        protected override void OnInputEnabled()
        {
            // Introduce the coin
            AnimElementUI coin = CreateAnimation();

            coin.SpriteName    = "coin";
            coin.Text          = "+" + data.CoinCount.ToString();
            coin.Size          = new Vector2(50, 50);
            coin.LocalPosition = new Vector3(-50, 25, 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      = data.PlayerAvatarColor;
                avatar.Size            = new Vector2(75, 75);
                avatar.LocalPosition   = avatarPosition;
                avatar.Animate(new UIAnimator.Expand(0.5f));

                Co.WaitForSeconds(0.5f, () => {
                    coin.Animate(new UIAnimator.Shrink(0.5f));

                    Co.WaitForSeconds(0.5f, () => {
                        avatar.Animate(new UIAnimator.Spin(0.5f, () => {
                            avatar.Animate(new UIAnimator.Shrink(0.5f));
                        }));
                    });
                });
            });
        }
Exemplo n.º 2
0
        void RunPotAnimation()
        {
            if (Elements["instruction4"].Visible && !animationsRun["pot"])
            {
                Co.WaitForSeconds(0.5f, () => {
                    int potStartCount = data.PotCount;
                    int potEndCount   = (int)(potStartCount * 1.5f);

                    AnimElementUI pot = CreateAnimation();
                    pot.SpriteName    = "coin_stack";
                    pot.Text          = potStartCount.ToString();
                    pot.Size          = new Vector2(100, 100);
                    pot.TextPadding   = new Vector2(-60, 0);
                    pot.Animate(new UIAnimator.Expand(1.5f));

                    Co.WaitForSeconds(4f, () => {
                        Co.StartCoroutine(2.5f, (float p) => {
                            pot.Text = Mathf.Ceil(Mathf.Lerp(potStartCount, potEndCount, p)).ToString();
                        });
                        Co.WaitForSeconds(0.5f, () => {
                            pot.Animate(new UIAnimator.Shrink(2f));
                        });
                    });
                });

                animationsRun["pot"] = true;
            }
        }
Exemplo n.º 3
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.º 4
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.º 5
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;
            }
        }