Exemple #1
0
    void CloseConnection(NetworkEntity entity)
    {
        var evt = ctx.CreateEntity();

        evt.AddConnectionEnd(entity.serverConnection);
        evt.isCleanup = true;

        entity.Destroy();
    }
    private static void OnEntityDestroyed(NetworkMessage message)
    {
        uint          id  = message.ReadUInt();
        NetworkEntity ent = EntityManager.Find(id);

        if (ent != null)
        {
            ent.Destroy();
        }
    }
Exemple #3
0
    private void ClientDisconnected(ulong id)
    {
        if (IsServer)
        {
            DebugLog("Client disconnected, removing ID: " + id);

            NetworkEntity ent = EntityManager.Find(clients[id].NetID);
            if (ent != null)
            {
                ent.Destroy();
            }

            clients.Remove(id);
        }

        if (IsClient)
        {
            DebugLog("Disconnected from server!");
            ShutDown();
        }
    }