Exemplo n.º 1
0
    /// <summary>
    /// Upon start this method sets the default values to be
    /// displayed on the status screen.
    /// </summary>
    void Start()
    {
        PlayerScript pScript = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerScript> ();
        int          myPNum  = pScript.pNum;


        player1Stats.fillFields();

        //the values should be set from characterStats?


        p2Joined = false;
        p3Joined = false;
        p4Joined = false;

        p2StatsGroup.gameObject.SetActive(false);
        p3StatsGroup.gameObject.SetActive(false);
        p4StatsGroup.gameObject.SetActive(false);

        NetworkManagerScript myNetwork = GameObject.FindObjectOfType <NetworkManagerScript> ();

        if (myNetwork != null)
        {
            allStats = myNetwork.GetComponentInChildren <AllNetworkedStats> ();


            if (allStats.gpas.Count > 1)
            {
                p2Joined = true;
            }
            if (allStats.gpas.Count > 2)
            {
                p3Joined = true;
            }
            if (allStats.gpas.Count > 3)
            {
                p4Joined = true;
            }
        }

        //These values need to be set based on number of players during multi-player game

        for (int i = 0; i < allStats.playerID.Count; i++)
        {
            if (myPNum != allStats.playerID [i])
            {
                GPAs.Add(allStats.gpas [i]);
                standings.Add(allStats.standings [i]);
                playerNames.Add(allStats.pNames [i]);
            }
        }



        //call method to set visibility
        SetPlayerVisibility(p2StatsGroup, p2Joined, 0);
        SetPlayerVisibility(p3StatsGroup, p3Joined, 1);
        SetPlayerVisibility(p4StatsGroup, p4Joined, 2);
    }
 public void CmdUpdateStats(int pID, float GPA, string standing, string pName)
 {
     myNetStats = gameObject.transform.parent.GetComponentInChildren <AllNetworkedStats> ();
     myNetStats.UpdateStats(pID, GPA, standing, pName);
 }