Esempio n. 1
0
    //function used for networking that compiles stats and destroys dead player objects
    public int reducePlayers(GameObject player)
    {
        numberAlive--;
        if (numberAlive > 0)
        {
            player.GetComponent <LocalPlayerScript>().removeMeter();
            player.GetComponent <LocalPlayerScript>().cancelSuperAnimation();
            Destroy(player);

            if (numberAlive == 1)
            {
                NetworkedPlayerScript winningPlayer = GameObject.FindGameObjectWithTag("Player").GetComponent <NetworkedPlayerScript>();

                winner = winningPlayer.getPlayerType();
                Debug.Log(winner);

                if (winningPlayer.getHasAuthority())
                {
                    winningPlayer.compileData();
                }
            }
        }

        else
        {
            displayResults();
        }
        return(numberOfPlayers);
    }