Exemplo n.º 1
0
    public void HandlePacket(Packet p)
    {
        switch (p.OpCode)
        {
        case Serializable.Packet.Types.OpCode.Seat:
        {
            Debug.Log("Client received seat packet");
            Serializable.Seat seat;
            if (!p.Data.TryUnpack(out seat))
            {
                return;
            }

            seatManager.AssignSeatByGUID(seat.GUID);

            clientContextManager.RegisterPlayerOwned(seat.GUID);

            client.UDPTryConnect();

            clientContextManager.gameObject.SetActive(true);
        }
        break;
        }
    }
Exemplo n.º 2
0
    void Start()
    {
        ClientContextManager context = null;

        foreach (GameObject rootGameObject in gameObject.scene.GetRootGameObjects())
        {
            context = rootGameObject.GetComponentInChildren <ClientContextManager>();
            if (context != null)
            {
                break;
            }
        }
        if (context == null)
        {
            return;
        }

        seat = GetComponent <Seat>();
        foreach (NetSync g in seat.ownerOf)
        {
            g.gameObject.AddComponent <PlayerController>();
            context.RegisterPlayerOwned(g.GUID);
        }
    }