public void Shutdown() { m_InputProcessors.Clear(); if (m_PlayerHandle != null) { PlayerHandleManager.RemovePlayerHandle(m_PlayerHandle); } }
void OnDestroy() { if (m_CustomPreviewCamera != null) { U.Object.Destroy(((MonoBehaviour)m_CustomPreviewCamera).gameObject); } PlayerHandleManager.RemovePlayerHandle(m_PlayerHandle); }
public void Start() { // Create a global player handle that listen to all relevant devices not already used // by other player handles. globalHandle = PlayerHandleManager.GetNewPlayerHandle(); globalHandle.global = true; playerPrefab.SetPlayerHandleMaps(globalHandle); joinAction.Bind(globalHandle); leaveAction.Bind(globalHandle); }
void Start() { controlls = playerInput.GetActions <JoinMap>(); for (int i = 0; i < players.Length; i++) { players[i].handle = PlayerHandleManager.GetNewPlayerHandle(); foreach (var item in players[i].GetComponent <Player>().renderers) { item.material = colourpool[i]; } } players[1].handle = PlayerHandleManager.GetNewPlayerHandle(); players[2].handle = PlayerHandleManager.GetNewPlayerHandle(); players[3].handle = PlayerHandleManager.GetNewPlayerHandle(); }
public void Start() { // Create a global player handle that listen to all relevant devices not already used // by other player handles. globalHandle = PlayerHandleManager.GetNewPlayerHandle(); globalHandle.global = true; List <ActionMapSlot> actionMaps = playerPrefab.GetComponent <PlayerInput>().actionMaps; foreach (ActionMapSlot actionMapSlot in actionMaps) { ActionMapInput actionMapInput = ActionMapInput.Create(actionMapSlot.actionMap); actionMapInput.TryInitializeWithDevices(globalHandle.GetApplicableDevices()); actionMapInput.active = actionMapSlot.active; actionMapInput.blockSubsequent = actionMapSlot.blockSubsequent; globalHandle.maps.Add(actionMapInput); } joinAction.Bind(globalHandle); leaveAction.Bind(globalHandle); }
void OnDestroy() { PlayerHandleManager.RemovePlayerHandle(m_PlayerHandle); }
public void InitializePlayerHandle() { m_PlayerHandle = PlayerHandleManager.GetNewPlayerHandle(); m_PlayerHandle.global = true; m_PlayerHandle.processAll = true; }
public void Update() { // Listen to if the join button was pressed on a yet unassigned device. if (joinAction.control.wasJustPressed) { // These are the devices currently active in the global player handle. List <InputDevice> devices = globalHandle.GetActions(joinAction.action.actionMap).GetCurrentlyUsedDevices(); PlayerHandle handle = PlayerHandleManager.GetNewPlayerHandle(); for (int i = 0; i < devices.Count; i++) { handle.AssignDevice(devices[i]); } playerPrefab.SetPlayerHandleMaps(handle); for (int i = 0; i < handle.maps.Count; i++) { // Activate the ActionMap that is used to join, // disregard active state from ActionMapSlots for now (wait until instantiating player). var map = handle.maps[i]; map.active = (map.actionMap == joinAction.action.actionMap); } players.Add(new PlayerInfo(handle, joinAction, leaveAction)); } int readyCount = 0; for (int i = players.Count - 1; i >= 0; i--) { var player = players[i]; if (!player.ready) { if (player.joinControl.wasJustPressed) { player.ready = true; } if (player.leaveControl.wasJustPressed) { player.playerHandle.Destroy(); players.Remove(player); continue; } } else { if (player.joinControl.wasJustPressed || player.leaveControl.wasJustPressed) { player.ready = false; } } if (player.ready) { readyCount++; } } if (readyCount >= 1 && (players.Count - readyCount) == 0) { StartGame(); } }
private void InitializePlayerHandle() { m_PlayerHandle = PlayerHandleManager.GetNewPlayerHandle(); m_PlayerHandle.global = true; }
public void Update() { // Listen to if the join button was pressed on a yet unassigned device. if (joinAction.control.wasJustPressed) { // These are the devices currently active in the global player handle. List <InputDevice> devices = globalHandle.GetActions(joinAction.action.actionMap).GetCurrentlyUsedDevices(); PlayerHandle handle = PlayerHandleManager.GetNewPlayerHandle(); foreach (var device in devices) { handle.AssignDevice(device, true); } foreach (ActionMapSlot actionMapSlot in playerPrefab.actionMaps) { ActionMapInput map = ActionMapInput.Create(actionMapSlot.actionMap); map.TryInitializeWithDevices(handle.GetApplicableDevices()); map.blockSubsequent = actionMapSlot.blockSubsequent; // Activate the ActionMap that is used to join, // disregard active state from ActionMapSlots for now (wait until instantiating player). if (map.actionMap == joinAction.action.actionMap) { map.active = true; } handle.maps.Add(map); } players.Add(new PlayerInfo(handle, joinAction, leaveAction)); } int readyCount = 0; for (int i = players.Count - 1; i >= 0; i--) { var player = players[i]; if (!player.ready) { if (player.joinControl.wasJustPressed) { player.ready = true; } if (player.leaveControl.wasJustPressed) { player.playerHandle.Destroy(); players.Remove(player); continue; } } else { if (player.joinControl.wasJustPressed || player.leaveControl.wasJustPressed) { player.ready = false; } } if (player.ready) { readyCount++; } } if (readyCount >= 1 && (players.Count - readyCount) == 0) { StartGame(); } }