示例#1
0
    // Start is called before the first frame update
    IEnumerator Start()
    {
        playerPrefab.SetActive(false);
        gameReady = false;

        spawnPoints = new List <Transform>();
        foreach (Transform child in transform)
        {
            spawnPoints.Add(child);
        }

        ClientEntity.CreateDummyPlayerHashtable();
        ClientEntity.gameStatus.SetLocal(true);

        while (!NetworkManager.inGamePlayersReady)
        {
            yield return(null);
        }

        playerPrefab.SetActive(true);
        if (NetworkManager.inRoom)
        {
            var players = NetworkManager.getSortedPlayers;
            foreach (var p in players)
            {
                CreatePlayer(p);
            }
        }
        else
        {
            CreatePlayer(ClientEntity.localPlayer);
        }
        playerPrefab.SetActive(false);

        gameReady = true;
    }