Пример #1
0
    private void OnNameIs(int cnnID, Net_NameIs msg)
    {
        // Add him to list
        ServerClient c = new ServerClient();

        c.connectionID = cnnID;
        c.playerName   = msg.playerName;

        clients.Add(c);

        // Link name to connection ID
        //clients.Find(x => x.connectionID == cnnID).playerName = msg.playerName;

        // Tell everyone new player connected
        Net_NewPlayerJoin newPlayerJoin = new Net_NewPlayerJoin();

        newPlayerJoin.playerName = msg.playerName;
        newPlayerJoin.cnnID      = cnnID;

        Send(newPlayerJoin, clients);

        if (clients.Count >= 2)
        {
            CreateAIManager();
        }
    }
Пример #2
0
    private void OnNewPlayer(Net_NewPlayerJoin msg)
    {
        //if (msg.cnnID == ourClientID) return;

        SpawnPlayer(msg.playerName, msg.cnnID);
    }