Ejemplo n.º 1
0
        void GameEnd()
        {
            GameInfo.gameCount++;
            timeLabel.text = "0";
            isGameStart    = false;
            isSpinStart    = false;
            fidgetSpinner.OnSpinStop();
            timingCircle.SpinStop();

            if (User.Instance.Score > User.Instance.HighScoreLoop)
            {
                User.Instance.HighScoreLoop = User.Instance.Score;
                resultPopup.BestSpriteOn();
                if (Social.localUser.authenticated)
                {
#if UNITY_ANDROID
                    Social.ReportScore(User.Instance.HighScoreLoop, GameInfo.leaderBoardLoopSpin, (bool success) =>
                    {
                        // handle success or failure
                    });
#elif (UNITY_IPHONE || UNITY_IOS)
                    Social.ReportScore(User.Instance.HighScoreLoop, GameInfo.leaderBoardLoopSpinIOS, (bool success) =>
                    {
                        // handle success or failure
                    });
#endif
                }
            }
            else
            {
                resultPopup.BestSpriteOff();
            }

            //resultPopup.scoreLabel.text = User.Instance.Score.ToString();
            resultPopup.highscoreLabel.text = User.Instance.HighScoreLoop.ToString();
            resultPopup.coinGainLabel.text  = "COIN  " + User.Instance.Score.ToString();
            resultPopup.coinMoreLabel.text  = (User.Instance.Score * 2).ToString();
            resultPopup.coinAdLabel.text    = (User.Instance.Score * 4).ToString();
            resultPopup.gameObject.SetActive(true);
            resultPopup.ShowScore(User.Instance.Score);
            resultPopup.BottomBtnAnimation();
            if (GameInfo.gameCount % 5 == 0 && User.Instance.Exp > 50000)
            {
                AdPopupChecker();
            }
            else
            {
                nativeAd.RequestNativeExpressAdView();
            }
        }
Ejemplo n.º 2
0
        // Update is called once per frame
        void Update()
        {
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                SceneManager.LoadScene("Main");
            }
            if (Input.GetMouseButtonDown(0))
            {
                if (!isGameStart && !resultPopup.gameObject.activeInHierarchy)
                {
                    //if (Advertisement.isShowing)
                    //{
                    //    return;
                    //}


                    moveHandIcon.AnimationOff();
                    isGameStart = true;
                }
            }
            if (!isGameStart)
            {
                return;
            }

            if (gameTime <= 0.0f)
            {
                GameInfo.gameCount++;
                timeLabel.text = "0";
                isGameStart    = false;
                fidgetSpinner.OnSpinStop();

                if (User.Instance.Score > User.Instance.HighScore)
                {
                    User.Instance.HighScore = User.Instance.Score;
                    resultPopup.BestSpriteOn();
                    if (Social.localUser.authenticated)
                    {
#if UNITY_ANDROID
                        Social.ReportScore(User.Instance.HighScore, GameInfo.leaderBoardTimedSpin, (bool success) =>
                        {
                            // handle success or failure
                        });
#elif (UNITY_IPHONE || UNITY_IOS)
                        Social.ReportScore(User.Instance.HighScore, GameInfo.leaderBoardTimedSpinIOS, (bool success) =>
                        {
                            // handle success or failure
                        });
#endif
                    }
                }
                else
                {
                    resultPopup.BestSpriteOff();
                }

                //resultPopup.scoreLabel.text = User.Instance.Score.ToString();
                resultPopup.highscoreLabel.text = User.Instance.HighScore.ToString();
                resultPopup.coinGainLabel.text  = "COIN  " + User.Instance.Score.ToString();
                resultPopup.coinMoreLabel.text  = (User.Instance.Score * 2).ToString();
                resultPopup.coinAdLabel.text    = (User.Instance.Score * 4).ToString();
                resultPopup.gameObject.SetActive(true);
                resultPopup.ShowScore(User.Instance.Score);
                resultPopup.BottomBtnAnimation();

                if (highSpeed > User.Instance.TimedSpinHighSpeed)
                {
                    User.Instance.TimedSpinHighSpeed = highSpeed;
                }
                if (GameInfo.gameCount % 5 == 0 && User.Instance.Exp > 50000)
                {
                    AdPopupChecker();
                }
                else
                {
                    nativeAd.RequestNativeExpressAdView();
                }


                return;
            }

            gameTime  -= Time.deltaTime;
            coinDelay -= Time.deltaTime;


            if (coinDelay <= 0.0f)
            {
                fidgetSpinner.IncreaseCoin();
                coinDelay = fidgetSpinner.CoinDelay;
                coinUI.SetCoinLabel(User.Instance.Coin);
            }

            timeLabel.text = gameTime.ToString("0.0");

            if (fidgetSpinner.IsSpin)
            {
                speedLabel.text = ((int)(fidgetSpinner.Speed)).ToString() + " m/s";
                SetLevelLabel();
                SetScoreLabel();

                if (fidgetSpinner.Speed > highSpeed)
                {
                    highSpeed = fidgetSpinner.Speed;
                }
            }
            else
            {
                speedLabel.text = "0 m/s";
            }
        }
Ejemplo n.º 3
0
        // Update is called once per frame
        void Update()
        {
            if (isGameOver)
            {
                return;
            }
            if (!isStarted)
            {
                return;
            }

            if (flowedTime >= harderTime)
            {
                Harder();
                if (harderTime < 20)
                {
                    harderTime += 4f;
                }
                else
                {
                    harderTime += 7f;
                }
            }

            if (this.GetComponent <UISprite>().fillAmount <= 0f)
            {
                isGameOver = true;
                score.SaveScore();

                if (User.Instance.ScoreGameSpin > User.Instance.HighScoreGameSpin)
                {
                    User.Instance.HighScoreGameSpin = User.Instance.ScoreGameSpin;
                    resultPopup.BestSpriteOn();
                    if (Social.localUser.authenticated)
                    {
#if UNITY_ANDROID
                        Social.ReportScore(User.Instance.HighScoreGameSpin, GameInfo.leaderBoardGameSpin, (bool success) =>
                        {
                            // handle success or failure
                        });
#elif (UNITY_IPHONE || UNITY_IOS)
                        Social.ReportScore(User.Instance.HighScoreGameSpin, GameInfo.leaderBoardGameSpinIOS, (bool success) =>
                        {
                            // handle success or failure
                        });
#endif
                    }
                }
                else
                {
                    resultPopup.BestSpriteOff();
                }
                User.Instance.Coin += (ulong)User.Instance.ScoreGameSpin * 2;

                //resultPopup.scoreLabel.text = User.Instance.ScoreGameSpin.ToString();
                resultPopup.highscoreLabel.text = User.Instance.HighScoreGameSpin.ToString();
                resultPopup.coinGainLabel.text  = "COIN  " + User.Instance.ScoreGameSpin.ToString();
                resultPopup.coinMoreLabel.text  = (User.Instance.ScoreGameSpin * 2).ToString();
                resultPopup.coinAdLabel.text    = (User.Instance.ScoreGameSpin * 4).ToString();
                resultPopup.gameObject.SetActive(true);
                resultPopup.ShowScore(User.Instance.ScoreGameSpin);
                resultPopup.BottomBtnAnimation();
                return;
            }

            this.GetComponent <UISprite>().fillAmount -= deltaAmount;
            flowedTime += Time.deltaTime;
        }