コード例 #1
0
    public void OnSceneLoaded(bool bFrontEnd)
    {
        spawnCarswClients = !bFrontEnd;
        RaceManager raceMan = GameObject.FindObjectOfType <RaceManager>();

        List <tk.TcpClient> clients = _server.GetClients();

        foreach (tk.TcpClient client in clients)
        {
            if (_server.debug)
            {
                Debug.Log("init network client.");
            }

            InitClient(client);
        }

        if (GlobalState.bCreateCarWithoutNetworkClient && !bFrontEnd && clients.Count == 0 && raceMan == null)
        {
            CarSpawner spawner = GameObject.FindObjectOfType <CarSpawner>();

            if (spawner)
            {
                if (_server.debug)
                {
                    Debug.Log("spawning car.");
                }

                spawner.Spawn(null);
            }
        }
    }
コード例 #2
0
    public void OnSceneLoaded(bool bFrontEnd)
    {
        spawnCarswClients = !bFrontEnd;

        List <tk.TcpClient> clients = _server.GetClients();

        foreach (tk.TcpClient client in clients)
        {
            if (_server.debug)
            {
                Debug.Log("init network client.");
            }

            InitClient(client);
        }

        if (GlobalState.paceCar && !bFrontEnd) // && clients.Count == 0
        {
            CarSpawner spawner = GameObject.FindObjectOfType <CarSpawner>();
            if (spawner)
            {
                spawner.EnsureOneCar();
            }
        }
    }