예제 #1
0
    private IEnumerator ContinueGameOver(float sec)
    {
        AdsManager.Instance.canShowAd = true;

        yield return(new WaitForSeconds(sec));

        if (isEndlessLevel)
        {
            endless.OnGameOver();
        }

        if (!SaveManager.Instance.data.firstGameOver)
        {
            print("This is the first gameover");
            //this is the first time we show gameover
            PlayServices.UnlockAchievement(GPGSIds.achievement_first_gameover);
            SaveManager.Instance.data.firstGameOver = true;
            SaveManager.Instance.Save();
        }
        gameOver = true;
        uiTab.SetActive(false);
        gameOverTab.SetActive(true);
        AudioManager.instance.PlaySound("GameOverSound");
        StartCoroutine(WaitThenUnplay(2.2f, .2f));
        cameraController.Stop();
    }
    //PlayerStats stats;

    private void Awake()
    {
        isCloudDataLoaded = false;
        Instance          = this;
        DontDestroyOnLoad(gameObject);
        //Debug.Log("Today is " + System.DateTime.Today.Date);
    }
예제 #3
0
 public void OnBallBuy()
 {
     if (SaveManager.Instance.DoesOwnBall(selectedBallIndex))
     {
         SetBall(selectedBallIndex);
     }
     else
     {
         if (SaveManager.Instance.BuyBall(selectedBallIndex, ballCosts[selectedBallIndex]))
         {
             //succes he bough the ball
             PlayServices.UnlockAchievement(GPGSIds.achievement_first_purchase);
             PlayServices.IncrementAchievement(GPGSIds.achievement_5_balls_purchased, 1);
             SetBall(selectedBallIndex);
             UpdateText();
         }
         else
         {
             //he dont have enough diamonds to buy it :C
             NotEnoughDiamondsText.text = "You need " + (ballCosts[selectedBallIndex] - SaveManager.Instance.data.diamonds);
             notEnoughMoneyTab.SetActive(true);
         }
     }
     OnNewPage();
 }
예제 #4
0
 private void StartRun()
 {
     PlayServices.UnlockAchiviment(CatRunServices.achievement_faa_uma_corrida);
     canMove = true;
     an.Play("runStart");
     speed = minSpeed;
 }
 void StartRun()
 {
     PlayServices.UnlockAnchievment(EndlessRunnerServices.achievement_faa_uma_corrida);
     anim.Play("runStart");
     speed   = minSpeed;
     canMove = true;
 }
예제 #6
0
 void leaderBtnFunction()
 {
     if (PlayerPrefs.GetInt("hasSound") == 0)
     {
         temp.Play();
     }
     PlayServices.OnShowLeaderBoard();
 }
예제 #7
0
 public static void Death()
 {
     lose = true;
     staticLoseText.SetActive(true);
     rb.gravityScale = 1;
     PlayServices.AddScoreToLeaderboard(GPGSIds.leaderboard_high_score__highest, points);
     SaveingManager.main.DeleteData();
 }
예제 #8
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Coin"))
        {
            PlayServices.IncrementeAchivement(CatRunServices.achievement_colete_100_peixes, 1);
            coins++;
            ulManager.UpdateCoins(coins);
            other.transform.parent.gameObject.SetActive(false);

            if (coins > PlayServices.GetPlayerScore(CatRunServices.leaderboard_ranking_coins))
            {
                PlayServices.PostScore((long)score, CatRunServices.leaderboard_ranking_coins);
            }
        }

        if (other.CompareTag("DoubleScore"))
        {
            StartCoroutine(DoublePoints(doubleScoreTime));
            other.gameObject.SetActive(false);
        }

        if (invencible)
        {
            return;
        }
        if (other.CompareTag("Obstacle"))
        {
            canMove = false;
            currentLife--;
            ulManager.UpdateLives(currentLife);
            an.SetTrigger("Hit");
            speed = 0;


            if (currentLife <= 0)
            {
                speed = 0;
                an.SetBool("Dead", true);
                ulManager.gameOverPanel.SetActive(true);

                if (score > PlayServices.GetPlayerScore(CatRunServices.leaderboard_ranking))
                {
                    PlayServices.PostScore((long)score, CatRunServices.leaderboard_ranking);
                }

                Invoke("CallMenu", 2f);
            }
            else
            {
                Invoke("CanMove", 0.75f);

                StartCoroutine(Blinking(invencibleTime));
            }
        }
    }
예제 #9
0
    private void Awake()
    {
        if (_instance != null && _instance != this)
        {
            Destroy(this.gameObject);
            return;
        }

        _instance = this;
        DontDestroyOnLoad(this.gameObject);
    }
예제 #10
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         DontDestroyOnLoad(gameObject);
         PlayGamesPlatform.DebugLogEnabled = true;
         PlayGamesPlatform.Activate();
         Debug.Log("Activated Services");
         SignIn();
     }
     else
     {
         Destroy(gameObject);
     }
 }
예제 #11
0
 void Start()
 {
     Instance = this;
     DontDestroyOnLoad(this);
     try
     {
         PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build();
         PlayGamesPlatform.InitializeInstance(config);
         PlayGamesPlatform.DebugLogEnabled = true;
         PlayGamesPlatform.Activate();
         Social.localUser.Authenticate((bool success) => { });
     }
     catch (Exception exception)
     {
         Debug.Log(exception);
     }
 }
예제 #12
0
 public void AddScoreToLeaderBoard(LevelType type)
 {
     if (type == LevelType.NormalLevels)
     {
         print("Adding snow score to leaderboard");
         PlayServices.IncrementAchievement(GPGSIds.achievement_completed_10_normal_levels, 1);
         PlayServices.IncrementAchievement(GPGSIds.achievement_completed_all_normal_levels, 1);
     }
     else if (type == LevelType.SnowLevels)
     {
         print("Adding snow score to leaderboard");
         PlayServices.IncrementAchievement(GPGSIds.achievement_completed_10_snow_levels, 1);
         PlayServices.IncrementAchievement(GPGSIds.achievement_completed_all_snow_levels, 1);
     }
     else if (type == LevelType.BlackAndWhite)
     {
         //TODO(Klendi): BW levels implement
     }
 }
예제 #13
0
 // Update is called once per frame
 void Update()
 {
     if (lives < 1)
     {
         PlayerPrefs.SetInt("CoinsC", coins);
         PlayServices.AddScoreToSkillLeaderboard();
         pauseBtn.gameObject.SetActive(false);
         gameOver.gameObject.SetActive(true);
         if (isSettingsActive == true)
         {
             gameOver.gameObject.SetActive(false);
         }
         if (isSettingsActive == false)
         {
             gameOver.gameObject.SetActive(true);
         }
         Time.timeScale = 0;
     }
 }
예제 #14
0
파일: Player.cs 프로젝트: hubity/TapColor
 void DeadCheck()
 {
     if (isDead == false && Camera.main.transform.position.y - transform.position.y > 6)
     {
         StopPlayer();
         DeadEffect();
         isDead = true;
         GameObject.Find("GameManager").GetComponent <GameManager>().GameOver();
         if (score > PlayServices.GetPlayerScore(GPGSIds.leaderboard_ranking))
         {
             PlayServices.PostScore((long)score, GPGSIds.leaderboard_ranking);
         }
         AdMob.instance.deaths++;
         if (AdMob.instance.deaths >= 3)
         {
             AdMob.instance.deaths = 0;
             AdMob.instance.ShowPopUp();
         }
     }
 }
예제 #15
0
 public void OnSnowEndlessClick()
 {
     //player can afford it and hasent unlocked snow endless
     if (SaveManager.Instance.data.specialDiamond >= 10 && !hasUnlockedSnowEndless)
     {
         print("Bough Snow Endless");
         PlayServices.UnlockAchievement(GPGSIds.achievement_unlock_snow_endless);
         SaveManager.Instance.data.specialDiamond        -= 10;
         SaveManager.Instance.data.hasUnlockedSnowEndless = true;
         SaveManager.Instance.Save();
         SceneManager.LoadScene("Endless_snow");
     }
     //he has bough it before
     else if (hasUnlockedNormalEndless)
     {
         SceneManager.LoadScene("Endless_snow");
     }
     else if (SaveManager.Instance.data.specialDiamond < 10 && !hasUnlockedSnowEndless)
     {
         //not enough diamonds
         endlessUnlockTab.SetActive(true);
         youNeedMoreDiamonds.text = "You have " + SaveManager.Instance.data.specialDiamond.ToString();
     }
 }
 private void Awake()
 {
     isCloudDataLoaded = false;
     Instance          = this;
     DontDestroyOnLoad(gameObject);
 }
예제 #17
0
 private void Awake()
 {
     playServices = GameObject.Find("GPS").GetComponent <PlayServices>();
 }
예제 #18
0
 public void ShowLeaderbordUI()
 {
     PlayServices.ShowLeaderBoard();
 }
예제 #19
0
 public void ShowLeaderBoardUI()
 {
     PlayServices.ShowLeaderboard(EndlessRunnerServices.leaderboard_ranking);
 }
예제 #20
0
 private void Awake()
 {
     playServices = this;
     DontDestroyOnLoad(gameObject);
 }
예제 #21
0
 public void ShowLeaderBoardUI()
 {
     PlayServices.ShowLeaderboard(GPGSIds.leaderboard_ranking);
 }
예제 #22
0
    // Update is called once per frame
    void Update()
    {
        if (lives > 6)
        {
            lives = 6;
        }
        switch (lives)
        {
        case 6:
            life1.gameObject.SetActive(true);
            life2.gameObject.SetActive(true);
            life3.gameObject.SetActive(true);
            life4.gameObject.SetActive(true);
            life5.gameObject.SetActive(true);
            life6.gameObject.SetActive(true);
            break;

        case 5:
            life1.gameObject.SetActive(true);
            life2.gameObject.SetActive(true);
            life3.gameObject.SetActive(true);
            life4.gameObject.SetActive(true);
            life5.gameObject.SetActive(true);
            life6.gameObject.SetActive(false);
            break;

        case 4:
            life1.gameObject.SetActive(true);
            life2.gameObject.SetActive(true);
            life3.gameObject.SetActive(true);
            life4.gameObject.SetActive(true);
            life5.gameObject.SetActive(false);
            life6.gameObject.SetActive(false);
            break;

        case 3:
            life1.gameObject.SetActive(true);
            life2.gameObject.SetActive(true);
            life3.gameObject.SetActive(true);
            life4.gameObject.SetActive(false);
            life5.gameObject.SetActive(false);
            life6.gameObject.SetActive(false);
            break;

        case 2:
            life1.gameObject.SetActive(true);
            life2.gameObject.SetActive(true);
            life3.gameObject.SetActive(false);
            life4.gameObject.SetActive(false);
            life5.gameObject.SetActive(false);
            life6.gameObject.SetActive(false);
            break;

        case 1:
            life1.gameObject.SetActive(true);
            life2.gameObject.SetActive(false);
            life3.gameObject.SetActive(false);
            life4.gameObject.SetActive(false);
            life5.gameObject.SetActive(false);
            life6.gameObject.SetActive(false);
            break;

        case 0:
            PlayerPrefs.SetInt("CoinsC", coins);
            PlayServices.AddScoreToLeaderboard();
            life1.gameObject.SetActive(false);
            life2.gameObject.SetActive(false);
            life3.gameObject.SetActive(false);
            life4.gameObject.SetActive(false);
            life5.gameObject.SetActive(false);
            life6.gameObject.SetActive(false);
            pauseBtn.gameObject.SetActive(false);
            gameOver.gameObject.SetActive(true);
            if (isSettingsActive == true)
            {
                gameOver.gameObject.SetActive(false);
            }
            if (isSettingsActive == false)
            {
                gameOver.gameObject.SetActive(true);
            }
            Time.timeScale = 0;
            break;

        default:
            PlayerPrefs.SetInt("CoinsC", coins);
            PlayServices.AddScoreToLeaderboard();
            life1.gameObject.SetActive(false);
            life2.gameObject.SetActive(false);
            life3.gameObject.SetActive(false);
            life4.gameObject.SetActive(false);
            life5.gameObject.SetActive(false);
            life6.gameObject.SetActive(false);
            pauseBtn.gameObject.SetActive(false);
            gameOver.gameObject.SetActive(true);
            if (isSettingsActive == true)
            {
                gameOver.gameObject.SetActive(false);
            }
            if (isSettingsActive == false)
            {
                gameOver.gameObject.SetActive(true);
            }
            Time.timeScale = 0;
            break;
        }
    }
예제 #23
0
 public void ShowAchievmentsUI()
 {
     PlayServices.ShowAchievments();
 }
예제 #24
0
 private void Awake()
 {
     playServices    = GameObject.Find("GPS").GetComponent <PlayServices>();
     audioController = GameObject.Find("Main Camera").GetComponent <AudioController>();
 }
예제 #25
0
    public void OnGameSucces()
    {
        cameraController.Play(.2f, false);
        AudioManager.instance.PlaySound("SuccesSound");
        StartCoroutine(WaitThenUnplay(2.2f, .2f));
        gameOver = true;
        succesTab.SetActive(true);
        uiTab.SetActive(false);
        highScoreDiamonds.text                    = string.Format("{0} / {1}", diamonds, totalDiamonds);
        highScoreSpecialDiamonds.text             = string.Format("{0} / {1}", specialDiamonds, totalSpecialDiamonds);
        SaveManager.Instance.data.diamonds       += diamonds;
        SaveManager.Instance.data.specialDiamond += specialDiamonds;
        AdsManager.Instance.canShowAd             = true;

        if (isEndlessLevel)
        {
            EndlessManager endless = FindObjectOfType <EndlessManager>();
            PlayGamesPlatform.Instance.LoadScores(
                GPGSIds.leaderboard_blitexs_endless,
                LeaderboardStart.PlayerCentered,
                1,
                LeaderboardCollection.Public,
                LeaderboardTimeSpan.AllTime,
                (LeaderboardScoreData data) =>
            {
                if (data.Valid)
                {
                    long total = data.PlayerScore.value + (long)endless.score;
                    PlayServices.AddScoreToLeaderBoard(GPGSIds.leaderboard_blitexs_endless, total);
                }
            });
        }

        if (SaveManager.Instance.data.completedLevels == 0)
        {
            //first level that is played
            PlayServices.UnlockAchievement(GPGSIds.achievement_first_level);
        }
        if (!isSnowLevel)
        {
            SaveManager.Instance.CompleteLevel(Manager.Instance.sceneIndex, false);

            if (SaveManager.Instance.data.completedLevels >= 15 && !SaveManager.Instance.data.hasUnlockedSnowTheme)
            {
                //player has completed 15 levels so now he unlocks snow theme
                print("Congrats u unlocked snow theme");
                PlayServices.UnlockAchievement(GPGSIds.achievement_unlocked_snow_theme);
                unlockedSnowTheme.SetActive(true);
                SaveManager.Instance.data.hasUnlockedSnowTheme = true;
                SaveManager.Instance.Save();
            }
        }

        else if (isSnowLevel)
        {
            print("It is a snow level and now calling complete level");
            SaveManager.Instance.CompleteLevel(Manager.Instance.sceneIndex, true);
        }

        PlayGamesPlatform.Instance.LoadScores(
            GPGSIds.leaderboard_blitexs_diamonds,
            LeaderboardStart.PlayerCentered,
            1,
            LeaderboardCollection.Public,
            LeaderboardTimeSpan.AllTime,
            (LeaderboardScoreData data) =>
        {
            if (data.Valid)
            {
                long total = data.PlayerScore.value + (long)diamonds;
                PlayServices.AddScoreToLeaderBoard(GPGSIds.leaderboard_blitexs_diamonds, total);
            }
        });

        PlayServices.IncrementAchievement(GPGSIds.achievement_100_diamonds, diamonds);
        PlayServices.IncrementAchievement(GPGSIds.achievement_1000_diamonds, diamonds);
        PlayServices.IncrementAchievement(GPGSIds.achievement_10_000_diamonds, diamonds);

        StartCoroutine(WaitThenDestroy(1.5f));
    }
예제 #26
0
 /// <summary>
 /// Creates an instance and activates "PlayGamesPlatform"
 /// </summary>
 public void Awake()
 {
     instance = this;
     PlayGamesPlatform.Activate();
 }
예제 #27
0
 public void OnLeaderBoardClick()
 {
     PlayServices.ShowLeaderBoardUI();
 }
예제 #28
0
 private void Awake()
 {
     instance = this;
     DontDestroyOnLoad(gameObject);
 }
예제 #29
0
 public void OnAchievementsClick()
 {
     PlayServices.ShowAchievementsUI();
 }