Exemplo n.º 1
0
    public GameObject InstantiatePlayer(int index)
    {
        GameObject temp = null;

        try
        {
            Console.LogError(index);
            if (index != connectionID)
            {
                temp = Instantiate(playerPrefab, new Vector3(0, 2, 0), Quaternion.identity);
                Console.Log("NonLocal");
            }
            else
            {
                temp = Instantiate(localPlayerPrefab, new Vector3(0, 2, 0), Quaternion.identity);
                menuCamera.enabled = false;
                Console.Log("Local");
            }

            SyncObject so = temp.GetComponent <SyncObject>();
            so.Init();

            SyncdObjects.Add(index, so);
        }
        catch (System.Exception e)
        {
            Console.LogError(e);
        }
        return(temp);
    }