コード例 #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));
                        }));
                    });
                });
            });
        }
コード例 #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;
            }
        }
コード例 #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;
     }
 }
コード例 #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();
                    }));
                }));
            });
        });
    }
コード例 #5
0
    public static AnimElementUI Create(Transform parent, Vector3 position)
    {
        AnimElementUI anim = ObjectPool.Instantiate <AnimElementUI> ();

        anim.Transform.SetParent(parent);
        anim.Transform.Reset();
        return(anim);
    }
コード例 #6
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;
            }
        }
コード例 #7
0
 protected AnimElementUI CreateAnimation(Vector3 position = new Vector3())
 {
     return(AnimElementUI.Create(AnimationContainer.Transform, position));
 }
コード例 #8
0
 AnimElementUI CreateAnimation(Vector3 position = new Vector3())
 {
     return(AnimElementUI.Create(Transform, position));
 }