예제 #1
0
    //Submits score to Kongregate
    public static void submit()
    {
#if UNITY_WEBPLAYER
        KongregateAPI.Submit("High Score", CurrentScore);
#else
        getTopHighScores();
#endif
    }
예제 #2
0
 public void GameOver(int winner)
 {
     isGameOver        = true;
     GameOverText.text = "Player " + winner + " wins!\n" +
                         "Press 'R' to begin a new game";
     if (GameObject.FindGameObjectWithTag("KongregateAPI") != null)
     {
         KongregateAPI Kong = GameObject.FindGameObjectWithTag("KongregateAPI").GetComponent <KongregateAPI>();
         if (Kong.Connected)
         {
             if (winner == 1)
             {
                 Kong.Submit("Russians Win", 1);
             }
             if (winner == 2)
             {
                 Kong.Submit("Germans Win", 1);
             }
         }
     }
 }
예제 #3
0
    // Use this for initialization
    void Start()
    {
        GameObject gameControllerObject = GameObject.FindWithTag("GameController");

        if (gameControllerObject != null)
        {
            gameController = gameControllerObject.GetComponent <GameController>();
        }
        scoreCounter = gameController.timeCounter;
        star3        = gameController.timeToGet3Stars;
        star2        = gameController.timeToGet2Stars;
        star1        = gameController.timeToGet1Stars;


        if (scoreCounter > star3)
        {
            animator.SetInteger("starCounter", 3);
            starsEarned = 3;
        }
        else if (scoreCounter > star2)
        {
            animator.SetInteger("starCounter", 2);
            starsEarned = 2;
        }
        else if (scoreCounter > star1)
        {
            animator.SetInteger("starCounter", 1);
            starsEarned = 1;
        }
        int tempScore = PlayerPrefs.GetInt("Score Level" + gameController.level, 0);

        if (tempScore < scoreCounter)
        {
            PlayerPrefs.SetInt("Score Level" + gameController.level, scoreCounter);
            if (PlayerPrefs.GetInt("Star Count Level" + gameController.level, 0) < starsEarned)
            {
                PlayerPrefs.SetInt("Star Count Level" + gameController.level, starsEarned);
                if (GameObject.Find("Kongregate API") != null)
                {
                    KongregateAPI Kong = GameObject.FindGameObjectWithTag("KongregateAPI").GetComponent <KongregateAPI>();
                    if (Kong.Connected)
                    {
                        Kong.Submit("Star Count Level" + gameController.level, starsEarned);
                    }
                }
            }
        }
    }