Пример #1
0
    void OnApplicationQuit()
    {
        ExitProto proto = new ExitProto();

        proto.id = player.GetComponent <Player>().GetID();
        _net.Send <ExitProto>(proto);

        _net.Disconnect();
    }
Пример #2
0
    void PlayerExitHandler(Codecs cs, byte[] data)
    {
        ExitProto proto = cs.Decode <ExitProto>(data);
        string    line  = "[" + proto.id + "] exit";

        print(line);

        if (proto.id == player.GetComponent <Player>().GetID())
        {
            return;
        }

        if (!_players.ContainsKey(proto.id))
        {
            return;
        }

        GameObject e = _players[proto.id];

        _players.Remove(proto.id);
        Destroy(e);
    }