Example #1
0
        public void Close()
        {
            if (closed)
            {
                return;
            }
            closed = true;

            if (obj != null)
            {
                obj.ConnectionDropped();
            }

            lock (parent.connections)
                parent.connections.Remove(this);

            System.Diagnostics.Debug.WriteLine(string.Format("{0} disconnected. Connections left: {1}",
                                                             this.obj == null ? "Unknown" : this.obj.ToString(), parent.connections.Count));

            if (socket != null)
            {
                socket.Close();
                socket = null;
            }

            obj = null;
        }
Example #2
0
    private void setUpGameObject(ObjectState ob, GameObject gameOb, SObject serverObject)
    {
        gameOb.name = ob.type + " [" + ob.uID + "]";
        if (ob.owner != "")
        {
            gameOb.name += "=> " + ob.owner;
        }


        System.Type t = System.Type.GetType(ob.type);

        if (t != null)
        {
            Debug.Log(t.ToString());
            IConnectedObject c = (IConnectedObject)gameOb.AddComponent(t);
            c.setState(ob);
        }
    }