Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        try
        {
            Input.GetButtonDown("RUISMenu");
        }
        catch (UnityException)
        {
            ruisMenuButtonDefined = false;
        }

        inputManager = FindObjectOfType(typeof(RUISInputManager)) as RUISInputManager;
        enablePSMove = inputManager.enablePSMove;
        psMoveIP     = inputManager.PSMoveIP;
        psMovePort   = inputManager.PSMovePort;

        jumpGesture = FindObjectOfType(typeof(RUISJumpGestureRecognizer)) as RUISJumpGestureRecognizer;

        displayManager = FindObjectOfType(typeof(RUISDisplayManager)) as RUISDisplayManager;
        riftDisplay    = displayManager.GetOculusRiftDisplay();

        // TODO: This menu should work with any stereo view, not just Rift. riftDisplay.linkedCamera is null when Rift is disabled.
        if (oculusRiftMenu && riftDisplay && riftDisplay.linkedCamera)
        {
            windowRect = new Rect(riftDisplay.linkedCamera.leftCamera.pixelRect.x
                                  + riftDisplay.resolutionX / 4 - 100, riftDisplay.resolutionY / 2 - 220, 250, 250);
        }

        SaveInputChanges();
    }
    void Awake()
    {
        characterController = GetComponent<RUISCharacterController>();
        jumpGesture = GetComponentInChildren<RUISJumpGestureRecognizer>();

        moveWrapper = FindObjectOfType(typeof(PSMoveWrapper)) as PSMoveWrapper;

        try
        {
            Input.GetAxis("Sprint");
        }
        catch (UnityException)
        {
			Debug.LogWarning("'Sprint' not defined in Unity Input settings");
        }

        try
        {
            Input.GetAxis("Turn");
        }
        catch (UnityException)
        {
			Debug.LogWarning("'Turn' not defined in Unity Input settings");
        }
		
		try
		{
			Input.GetAxis("Jump");
		}
		catch (UnityException)
		{
			Debug.LogWarning("'Jump' not defined in Unity Input settings");
		}
    }
Ejemplo n.º 3
0
    void Awake()
    {
        characterController = GetComponent <RUISCharacterController>();
        jumpGesture         = GetComponentInChildren <RUISJumpGestureRecognizer>();

        moveWrapper = FindObjectOfType(typeof(PSMoveWrapper)) as PSMoveWrapper;

        try
        {
            Input.GetAxis("Sprint");
        }
        catch (UnityException)
        {
            Debug.LogWarning("'Sprint' not defined in Unity Input settings");
        }

        try
        {
            Input.GetAxis("Turn");
        }
        catch (UnityException)
        {
            Debug.LogWarning("'Turn' not defined in Unity Input settings");
        }

        try
        {
            Input.GetAxis("Jump");
        }
        catch (UnityException)
        {
            Debug.LogWarning("'Jump' not defined in Unity Input settings");
        }
    }
Ejemplo n.º 4
0
    void Start()
    {
        if (this.transform.parent == null)
        {
            this.currentMenuState = RUISMenuStates.calibration;
        }

        try
        {
            Input.GetButtonDown("RUISMenu");
        }
        catch (UnityException)
        {
            ruisMenuButtonDefined = false;
        }

        foreach (GameObject button in buttons)
        {
            UIEventListener.Get(button).onClick += buttonPressed;
        }

        foreach (GameObject checkBox in checkBoxes)
        {
            UIEventListener.Get(checkBox).onClick += checkBoxClicked;
        }

        foreach (GameObject textField in textFields)
        {
            UIEventListener.Get(textField).onInput += textFieldChanged;
        }


        currentMenuState = RUISMenuStates.selectAndConfigureDevices;

        jumpGesture = FindObjectOfType(typeof(RUISJumpGestureRecognizer)) as RUISJumpGestureRecognizer;

        SaveInputChanges();         // Save initial settings
        updateCalibratableDevices();

        UpdateGUI();
        handleInfotexts();
        handleSelectAndConfigureDevicesGUISpacing();

        // Menu is hidden upon init
        Hide3DGUI();

        this.transform.localPosition = new Vector3(displayManager.guiX, displayManager.guiY, displayManager.guiZ);
        this.transform.localScale    = new Vector3(displayManager.guiScaleX, displayManager.guiScaleY, 1);

        if (displayManager.displays[displayManager.guiDisplayChoice].isObliqueFrustum &&
            displayManager.displays[displayManager.guiDisplayChoice].linkedCamera &&
            !displayManager.displays[displayManager.guiDisplayChoice].linkedCamera.isHmdCamera)
        {
            this.transform.localRotation = Quaternion.LookRotation(-displayManager.displays[displayManager.guiDisplayChoice].DisplayNormal,
                                                                   displayManager.displays[displayManager.guiDisplayChoice].DisplayUp);
            this.transform.localPosition = displayManager.displays[displayManager.guiDisplayChoice].displayCenterPosition
                                           + this.transform.localRotation * new Vector3(displayManager.guiX, displayManager.guiY, displayManager.guiZ);
        }
    }
Ejemplo n.º 5
0
    // end // Head/Body turn gesture

    void Awake()
    {
        characterController = GetComponent <RUISCharacterController>();
        jumpGesture         = GetComponentInChildren <RUISJumpGestureRecognizer>();

        //moveWrapper = FindObjectOfType(typeof(PSMoveWrapper)) as PSMoveWrapper;
        bimanualSwingingRecognizer = FindObjectOfType(typeof(RUISBimanualSwingingRecognizer)) as RUISBimanualSwingingRecognizer;         // TODO: Shouldn't probably check whole scene
        coordinateSystem           = FindObjectOfType(typeof(RUISCoordinateSystem)) as RUISCoordinateSystem;
        skeletonManager            = FindObjectOfType(typeof(RUISSkeletonManager)) as RUISSkeletonManager;

        try
        {
            Input.GetAxis("Sprint");
        }
        catch (UnityException)
        {
            Debug.LogWarning("'Sprint' not defined in Unity Input settings");
        }

        try
        {
            Input.GetAxis("Turn");
        }
        catch (UnityException)
        {
            Debug.LogWarning("'Turn' not defined in Unity Input settings");
        }

        try
        {
            Input.GetAxis("Jump");
        }
        catch (UnityException)
        {
            Debug.LogWarning("'Jump' not defined in Unity Input settings");
        }
    }
Ejemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        try
        {
            Input.GetButtonDown("RUISMenu");
        }
        catch (UnityException)
        {
            ruisMenuButtonDefined = false;
        }

        inputManager = FindObjectOfType(typeof(RUISInputManager)) as RUISInputManager;
        enablePSMove = inputManager.enablePSMove;
        psMoveIP = inputManager.PSMoveIP;
        psMovePort = inputManager.PSMovePort;

        jumpGesture = FindObjectOfType(typeof(RUISJumpGestureRecognizer)) as RUISJumpGestureRecognizer;

        displayManager = FindObjectOfType(typeof(RUISDisplayManager)) as RUISDisplayManager;
        riftDisplay = displayManager.GetOculusRiftDisplay();

        // TODO: This menu should work with any stereo view, not just Rift. riftDisplay.linkedCamera is null when Rift is disabled.
        if (oculusRiftMenu && riftDisplay && riftDisplay.linkedCamera )
        {
            windowRect = new Rect(riftDisplay.linkedCamera.leftCamera.pixelRect.x
                                    + riftDisplay.resolutionX / 4 - 100, riftDisplay.resolutionY / 2 - 220, 250, 250);
        }

        SaveInputChanges();
    }
Ejemplo n.º 7
0
	void Start () 
	{
		if(this.transform.parent == null) 
		{
			this.currentMenuState = RUISMenuStates.calibration;
		}
		
		try
		{
			Input.GetButtonDown("RUISMenu");
		}
		catch (UnityException)
		{
			ruisMenuButtonDefined = false;
		}
		
		foreach(GameObject button in buttons) 
		{
			UIEventListener.Get(button).onClick += buttonPressed;
		}
		
		foreach(GameObject checkBox in checkBoxes) 
		{
			UIEventListener.Get (checkBox).onClick += checkBoxClicked;
		}
		
		foreach(GameObject textField in textFields) 
		{
			UIEventListener.Get (textField).onInput += textFieldChanged;
		}
		
		
		currentMenuState = RUISMenuStates.selectAndConfigureDevices;
		
		jumpGesture = FindObjectOfType(typeof(RUISJumpGestureRecognizer)) as RUISJumpGestureRecognizer;
		
		SaveInputChanges(); // Save initial settings
		updateCalibratableDevices();
		
		UpdateGUI();
		handleInfotexts();
		handleSelectAndConfigureDevicesGUISpacing();
		
		// Menu is hidden upon init
		Hide3DGUI();

		this.transform.localPosition = new Vector3(displayManager.guiX, displayManager.guiY, displayManager.guiZ);
		this.transform.localScale = new Vector3(displayManager.guiScaleX, displayManager.guiScaleY, 1);
		
		if(displayManager.displays[displayManager.guiDisplayChoice].isObliqueFrustum && !displayManager.displays[displayManager.guiDisplayChoice].enableOculusRift)
		{
			this.transform.localRotation = Quaternion.LookRotation(-displayManager.displays[displayManager.guiDisplayChoice].DisplayNormal, 
			                                                        displayManager.displays[displayManager.guiDisplayChoice].DisplayUp     );
			this.transform.localPosition = displayManager.displays[displayManager.guiDisplayChoice].displayCenterPosition
											+ this.transform.localRotation * new Vector3(displayManager.guiX, displayManager.guiY, displayManager.guiZ);
		}
	}