Esempio n. 1
0
    protected override void OnStatusChanged(NetIncomingMessage msg)
    {
        switch (msg.SenderConnection.Status)
        {
        case NetConnectionStatus.Connected:
            var new_client = GetClientInfo(msg);
            connected_clients.Add(new_client);
            NetworkRemoteCall.CallOnClient(new_client, "Hello", new_client.host_id);
            break;

        case NetConnectionStatus.Disconnecting:
        case NetConnectionStatus.Disconnected:
            connected_clients.Remove(GetClientInfo(msg));
            break;
        }
    }
Esempio n. 2
0
    public void RequestObjects(NetIncomingMessage msg)
    {
        var client = GetClientInfo(msg);

        foreach (var obj in NetworkActorRegistry.Objects)
        {
            if (obj != null)
            {
                NetworkRemoteCall.CallOnClient(
                    client, "Spawn",
                    obj.host_id, obj.actor_id, obj.prefab_name,
                    obj.transform.position, obj.transform.rotation
                    );
            }
        }
    }