public void Streamer_GuestConnected(object sender, Parsec.ParsecGuest guest) { int parsecPlayerId = _parsecPlayerIdCount; _parsecPlayerIdCount++; if (rewiredPlayers.Count == 0) { Debug.LogWarning("ParsecManager : No rewired players to assign"); return; } string rewiredPlayerId = _GetAvailableRewiredPlayer(); CustomController csControllerJoystick = ReInput.controllers.CreateCustomController(0, "Parsec_" + guest.id); CustomController csControllerKeyboard = ReInput.controllers.CreateCustomController(1, "Parsec_" + guest.id); CustomController csControllerMouse = ReInput.controllers.CreateCustomController(2, "Parsec_" + guest.id); ParsecInput.AssignGuestToPlayer(guest, parsecPlayerId); Player rewiredPlayer = ReInput.players.GetPlayer(rewiredPlayerId); ParsecRewiredInput.AssignCustomControllerToUser(guest, csControllerJoystick); ParsecRewiredInput.AssignKeyboardControllerToUser(guest, csControllerKeyboard); ParsecRewiredInput.AssignMouseControllerToUser(guest, csControllerMouse); rewiredPlayer.controllers.AddController(csControllerJoystick, true); rewiredPlayer.controllers.AddController(csControllerKeyboard, true); rewiredPlayer.controllers.AddController(csControllerMouse, true); _rewiredPlayerByGuestIds.Add(guest.id, rewiredPlayerId); _guestIdByRewiredPlayer.Add(rewiredPlayerId, guest.id); _customControllersByGuestIds.Add(guest.id, new CustomController[] { csControllerJoystick, csControllerKeyboard, csControllerMouse }); }
public void Setup() { ParsecInput.AssignGuestToPlayer(m_AssignedGuest, m_PlayerNumber); m_Movement = m_Instance.GetComponent <PlayerMovement>(); if (m_Movement != null) { m_Movement.player = m_PlayerNumber; } }
public void Setup(CustomController controller, CustomController keyboard, CustomController mouse) { ParsecInput.AssignGuestToPlayer(m_AssignedGuest, m_PlayerNumber); m_Movement = m_Instance.GetComponent <PlayerMovement>(); if (m_Movement != null) { if (controller != null) { ParsecRewiredInput.AssignCustomControllerToUser(m_AssignedGuest, controller); } if (keyboard != null) { ParsecRewiredInput.AssignKeyboardControllerToUser(m_AssignedGuest, keyboard); } if (mouse != null) { ParsecRewiredInput.AssignMouseControllerToUser(m_AssignedGuest, mouse); } m_Movement.player = m_PlayerNumber; m_Movement.initReInput(controller, keyboard, mouse); } }