protected static void HandleJoinRoom(int roomID, byte[] player)
    {
        Player playerJoined = player.DeserializeObject <Player>();

        //=================================================================================================================================
        Neutron.Enqueue(() => Neutron.Fire(Neutron.onPlayerJoinedRoom, new object[] { playerJoined, roomID }), ref monoBehaviourActions);
    }
    protected static void HandleJoinChannel(int ID, byte[] Player)
    {
        Player playerJoined = Player.DeserializeObject <Player>();

        //===============================================================================================================================
        Neutron.Enqueue(() => Neutron.Fire(Neutron.onPlayerJoinedChannel, new object[] { playerJoined, ID }), ref monoBehaviourActions);
    }
 //============================================================================================================//
 protected static void HandleConnected(string status, int uniqueID)
 {
     Logger(status);
     //=============================================
     Neutron.myPlayer = new Player(uniqueID, null);
     //=============================================
     Neutron.Enqueue(() => Neutron.Fire(Neutron.onNeutronConnected, new object[] { true }), ref monoBehaviourActions);
 }
    protected static void HandleNavMeshAgent(int ownerID, Vector3 inputPoint)
    {
        NeutronObject obj = neutronObjects[ownerID];

        if (obj.agent != null)
        {
            Neutron.Enqueue(() => obj.agent.SetDestination(inputPoint), ref monoBehaviourActions);
        }
    }
    protected static void HandlePlayerDisconnected(byte[] player)
    {
        Player playerDisconnected = player.DeserializeObject <Player>();
        //===================================================================================\\
        NeutronObject obj = neutronObjects[playerDisconnected.ID];

        //===================================================================================\\
        Neutron.Enqueue(() => Destroy(obj.gameObject), ref monoBehaviourActions);
        //===================================================================================\\
        neutronObjects.Remove(obj.Infor.ownerID);
    }
    protected static void HandleInstantiate(Vector3 pos, Quaternion rot, string playerPrefab, byte[] mPlayer)
    {
        //================================================================================================================================\\
        Player playerInstantiated = mPlayer.DeserializeObject <Player>();

        //================================================================================================================================\\
        Neutron.Enqueue(() =>
        {
            GameObject playerPref = Resources.Load(playerPrefab, typeof(GameObject)) as GameObject;
            if (playerPref != null)
            {
                Neutron.onPlayerInstantiated(playerInstantiated, pos, rot, playerPref);
            }
            else
            {
                LoggerError($"CLIENT: -> Unable to load prefab {playerPrefab}");
            }
        }, ref monoBehaviourActions);
    }
 protected static void HandleDestroyPlayer()
 {
     Neutron.Enqueue(() => Neutron.Fire(Neutron.onDestroyed, new object[] { }), ref monoBehaviourActions);
 }
 protected static void HandleGetRooms(Room[] room, NeutronReader[] options)
 {
     Neutron.Enqueue(() => Neutron.Fire(Neutron.onRoomsReceived, new object[] { room, options }), ref monoBehaviourActions);
 }
 protected static void HandleCreateRoom(Room room, NeutronReader options)
 {
     Neutron.Enqueue(() => Neutron.Fire(Neutron.onCreatedRoom, new object[] { room, options }), ref monoBehaviourActions);
 }
 protected static void HandleGetChannels(byte[] mChannels)
 {
     Neutron.Enqueue(() => Neutron.Fire(Neutron.onChannelsReceived, new object[] { mChannels.DeserializeObject <Channel[]>() }), ref monoBehaviourActions);
 }
 protected static void HandleDatabase(Packet packet, object[] response)
 {
     Neutron.Enqueue(() => Neutron.Fire(Neutron.onDatabasePacket, new object[] { packet, response }), ref monoBehaviourActions);
 }
 protected static void HandleRPC(int id, byte[] parameters)
 {
     Neutron.Enqueue(() => ResponseRPC(id, parameters), ref monoBehaviourRPCActions);
 }
 protected static void HandleSendChat(string message, byte[] sender)
 {
     Neutron.Enqueue(() => Neutron.Fire(Neutron.onMessageReceived, new object[] { message, sender.DeserializeObject <Player>() }), ref monoBehaviourActions);
 }