Esempio n. 1
0
    IEnumerator Start()
    {
        PlayerProperties.gameStatus.SetLocal(true);

        while (!PlayerProperties.GetAllGameStatus())
        {
            yield return(null);
        }

        if (!NetworkManager.inRoom)
        {
            var gobj = Instantiate(builderPrefab);
            var eb   = gobj.GetComponent <EntityBase>();
            eb.EntityID    = 1;
            eb.authorityID = -1;
            eb.Register();

            yield break;
        }

        var i       = 1;
        var counter = 10;
        var players = NetworkManager.getSortedPlayers;

        foreach (var p in players)
        {
            var item = PlayerProperties.playerTeam.Get(p) == 0 ? builderPrefab : kaijuPrefab;
            var gobj = Instantiate(item);
            var eb   = gobj.GetComponent <EntityBase>();
            eb.EntityID    = i;
            eb.authorityID = p.ID;
            eb.Register();

            i += counter;
        }
    }