float endingTime; //Wait for 1 seconds then end the game

    // Use this for initialization
    void Start()
    {
        //Rest the latestscore PlayerPrefs, otherwise if the game ends without any player
        //killing any of the enemies, then the score displayed at the end would be the one
        //from the player last game
        PlayerPrefs.SetInt("LatestScore", 0);

        //We want to wait for both players to connect before spawning enemy
        enemyManagerPlayer1.SetActive(false);
        enemyManagerPlayer2.SetActive(false);

        //The image blocks our view when editing the game, so its only activated when the game start
        GameObject.FindGameObjectWithTag("Skill1").GetComponent <Image> ().enabled = true;

        //Get the network manager
        netManager = GameObject.FindGameObjectWithTag("NetManager").GetComponent <NetworkManager> ();

        counter    = 0;
        gameEnding = false;
        gameStart  = false;
        endingTime = 0;

        scoreText    = GameObject.FindGameObjectWithTag("ScoreText");
        scoreManager = scoreText.GetComponent <ScoreManagerMult> ();
    }
예제 #2
0
    ScoreManagerMult scoreManager; //Reference to the GUI text that display the score

    // Use this for initialization
    void Start()
    {
        score = 0;

        scoreText    = GameObject.FindGameObjectWithTag("ScoreText");
        scoreManager = scoreText.GetComponent <ScoreManagerMult> ();

        //Assign the local player to the scoreManager so it can display the correct
        //score.
        if (isLocalPlayer)
        {
            scoreManager.player = gameObject;
        }
    }