public void ReadState(ControllerState outState) { #if UNITY_HAS_GOOGLEVR if (InstantPreview.Instance != null && InstantPreview.Instance.IsCurrentlyConnected && !EmulatorManager.Instance.Connected) { // Uses Instant Preview to get controller state if connected. instantPreviewControllerProvider.ReadState(outState); return; } #endif // UNITY_HAS_GOOGLEVR // If Instant Preview is not connected, tries to use the emulator or // mouse. emulatorControllerProvider.ReadState(emulatorState); mouseControllerProvider.ReadState(mouseState); // Defaults to mouse state if the emulator isn't available. if (emulatorState.connectionState != GvrConnectionState.Connected && mouseState.connectionState == GvrConnectionState.Connected) { outState.CopyFrom(mouseState); } else { outState.CopyFrom(emulatorState); } }
public void ReadState(ControllerState outState, int controller_id) { if (controller_id >= MaxControllerCount) { return; } #if UNITY_ANDROID if (InstantPreview.IsActive && !EmulatorManager.Instance.Connected) { // Uses Instant Preview to get controller state if connected. instantPreviewControllerProvider.ReadState(outState, controller_id); return; } #endif // UNITY_ANDROID // If Instant Preview is not connected, tries to use the emulator or // mouse. emulatorControllerProvider.ReadState(emulatorState, controller_id); mouseControllerProvider.ReadState(mouseState, controller_id); // Defaults to mouse state if the emulator isn't available. if (emulatorState.connectionState != GvrConnectionState.Connected && mouseState.connectionState == GvrConnectionState.Connected) { outState.CopyFrom(mouseState); } else { outState.CopyFrom(emulatorState); } }
public void ReadState(ControllerState outState, int controller_id) { emulatorControllerProvider.ReadState(emulatorState, controller_id); mouseControllerProvider.ReadState(mouseState, controller_id); // Defaults to mouse state if the emulator isn't available. if (emulatorState.connectionState != GvrConnectionState.Connected && mouseState.connectionState == GvrConnectionState.Connected) { outState.CopyFrom(mouseState); } else { outState.CopyFrom(emulatorState); } }
public void ReadState(ControllerState outState) { // If Instant Preview is not connected, tries to use the emulator or // mouse. emulatorControllerProvider.ReadState(emulatorState); mouseControllerProvider.ReadState(mouseState); // Defaults to mouse state if the emulator isn't available. if (emulatorState.connectionState != GvrConnectionState.Connected && mouseState.connectionState == GvrConnectionState.Connected) { outState.CopyFrom(mouseState); } else { outState.CopyFrom(emulatorState); } }