Exemplo n.º 1
0
 /// <summary>
 /// This function issues the InitiateConnection command to the holoboard controller and sets up the UI to recieve state updates
 /// </summary>
 public void Connect()
 {
     mHoloboardController.InitiateConnection();
     Button1.SetActive(false);
     Button2.SetActive(false);
     Button.SetActive(false);
     LoadingCircle.SetActive(true);
     InstructionsText.text = "Connecting..";
 }
Exemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     mHoloboardController = HoloboardController.Instance;
     TroubleShootScreen.SetActive(false);
     LoadingCircle.SetActive(false);
     PairRequest.SetActive(false);
     LEDImage.enabled = false;
     Button1.SetActive(false);
     ControllerCallbacks.OnControllerStateChanged += ControllerCallbacks_OnControllerStateChanged;
 }
Exemplo n.º 3
0
    // Start is called before the first frame update
    void Start()
    {
        //Changer = GameObject.Find("MainCamera");
        //Camerachanger = Changer.GetComponent<CameraChanger>();
        Image1.SetActive(false);
        Button1.SetActive(false);
        Image3.SetActive(false);
        Button3.SetActive(false);

        //Text1.SetActive(false);
    }
Exemplo n.º 4
0
 public void Onclick2()
 {
     Image1.SetActive(false);
     Button1.SetActive(false);
     //Text1.SetActive(false);
 }
Exemplo n.º 5
0
 public void OnClick()
 {
     Image1.SetActive(true);
     Button1.SetActive(true);
     //Text1.SetActive(true);
 }
Exemplo n.º 6
0
    /// <summary>
    /// Callback for controller state changes
    /// </summary>
    /// <param name="obj">New Controller state</param>
    void ControllerCallbacks_OnControllerStateChanged(CONTROLLER_STATE obj)
    {
        switch (obj)
        {
        case CONTROLLER_STATE.DEVICE_NOT_FOUND:
            TroubleShootScreen.SetActive(false);
            PairRequest.SetActive(false);
            LoadingCircle.SetActive(true);
            InstructionsText.text = "Connecting.. \n\nPlease Ensure The Blue Light Is Blinking On The Connector \n\nPlease Press The Controller Button Once Again";
            StartCoroutine(BlinkLED());
            Button2.SetActive(true);
            Button.SetActive(false);
            break;

        case CONTROLLER_STATE.FOUND_CONTROLLER:
            TroubleShootScreen.SetActive(false);
            PairRequest.SetActive(false);
            LoadingCircle.SetActive(true);
            Blinking = false;
            Button2.SetActive(false);
            Button1.SetActive(false);
            Button.SetActive(false);
            InstructionsText.text = "Connecting.. \n\nController Found!";
            break;

        case CONTROLLER_STATE.RECONNECTING:
            TroubleShootScreen.SetActive(false);
            PairRequest.SetActive(false);
            LoadingCircle.SetActive(true);
            StartCoroutine(BlinkLED());
            Button2.SetActive(true);
            Button.SetActive(false);
            InstructionsText.text = "Connecting.. \n\nPlease Ensure The Blue Light Is Blinking On The Connector \n\nPlease Press The Controller Button Once Again";
            break;

        case CONTROLLER_STATE.TROUBLESHOOT:
            TroubleShootScreen.SetActive(true);
            PairRequest.SetActive(false);
            LoadingCircle.SetActive(false);
            InstructionsText.text = "";
            StartCoroutine(TroubleShootBlink());
            Blinking = false;
            Button2.SetActive(true);
            Button1.SetActive(true);
            Button.SetActive(false);
            break;

        case CONTROLLER_STATE.BLE_INACTIVE:
            Blinking = false;
            if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                InstructionsText.text = "Please ensure Bluetooth is enabled in the Control Center \n\nPlease Press The Controller Button Once Again";
            }
            else if (Application.platform == RuntimePlatform.Android)
            {
                InstructionsText.text = "Please ensure Bluetooth is enabled \n\nPress Connect Once Again";
            }
            else
            {
                InstructionsText.text = "Please ensure Bluetooth is enabled \n\nPress Connect Once Again";
            }

            if (Application.platform != RuntimePlatform.IPhonePlayer)
            {
                Button.SetActive(true);
                ButtonText.text = "Connect";
            }

            PairRequest.SetActive(false);
            Button2.SetActive(true);
            Button1.SetActive(false);
            LoadingCircle.SetActive(false);
            break;

        case CONTROLLER_STATE.PAIR_REQUEST:
            TroubleShootScreen.SetActive(false);
            PairRequest.SetActive(true);
            LoadingCircle.SetActive(true);
            StartCoroutine(BlinkLED());
            Button2.SetActive(true);
            Button.SetActive(false);
            InstructionsText.text = "";
            break;

        case CONTROLLER_STATE.SUBSCRIBED:
            Controller.sprite = Controller_HL;
            Blinking          = false;
            TSBlinking        = false;
            TroubleShootScreen.SetActive(false);
            PairRequest.SetActive(false);
            LoadingCircle.SetActive(false);
            Button2.SetActive(false);
            Button1.SetActive(false);
            InstructionsText.text = "Controller Connected! \n\nPress Ready To Begin";
            ButtonText.text       = "Ready";
            Button.SetActive(true);
            break;
        }
    }
Exemplo n.º 7
0
    // Update is called once per frame
    void Update()
    {
        if (OVRInput.GetDown(OVRInput.RawButton.RIndexTrigger))
        {
            // Wall position
            if (BuildStage == 0 && Building == true)
            {
                Wall.SetActive(true);

                WallYrot = ReturnReferencePosition().transform.eulerAngles.y;

                WallPosition = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);

                _wallBuilder.UpdateWallPosition(WallPosition, WallYrot);

                // Save values
                PlayerPrefs.SetFloat("WallPositionX", WallPosition.x);
                PlayerPrefs.SetFloat("WallPositionY", WallPosition.y);
                PlayerPrefs.SetFloat("WallPositionZ", WallPosition.z);

                PlayerPrefs.SetFloat("WallRotationY", WallYrot);

                // Change instructions
                Ins1.SetActive(false);
                Ins2.SetActive(true);
            }

            // Desk position
            if (BuildStage == 1 && Building == true)
            {
                Desk.SetActive(true);

                DeskYrot = ReturnReferencePosition().transform.eulerAngles.y;

                DeskPosition = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);

                _deskBuilder.UpdateDeskPosition(DeskPosition, DeskYrot);

                // Save values
                PlayerPrefs.SetFloat("DeskPositionX", DeskPosition.x);
                PlayerPrefs.SetFloat("DeskPositionY", DeskPosition.y);
                PlayerPrefs.SetFloat("DeskPositionZ", DeskPosition.z);

                PlayerPrefs.SetFloat("DeskRotationY", DeskYrot);

                // Change instructions
                Ins2.SetActive(false);
                Ins3.SetActive(true);
            }

            // Desk height
            if (BuildStage == 2 && Building == true)
            {
                DeskHeight = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);

                _deskBuilder.UpdateDeskHeight(DeskHeight);

                // Save values
                PlayerPrefs.SetFloat("DeskHeightX", DeskHeight.x);
                PlayerPrefs.SetFloat("DeskHeightY", DeskHeight.y);
                PlayerPrefs.SetFloat("DeskHeightZ", DeskHeight.z);

                // Change instructions
                Ins3.SetActive(false);
                Ins4.SetActive(true);
            }


            // Desk right
            if (BuildStage == 3 && Building == true)
            {
                DeskRight = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);

                _deskBuilder.UpdateDeskRight(DeskRight);

                // Save values
                PlayerPrefs.SetFloat("DeskRightX", DeskRight.x);
                PlayerPrefs.SetFloat("DeskRightY", DeskRight.y);
                PlayerPrefs.SetFloat("DeskRightZ", DeskRight.z);

                // Change instructions
                Ins4.SetActive(false);
                Ins5.SetActive(true);
            }

            // Desk left
            if (BuildStage == 4 && Building == true)
            {
                DeskLeft = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);

                _deskBuilder.UpdateDeskLeft(DeskLeft);

                // Save values
                PlayerPrefs.SetFloat("DeskLeftX", DeskLeft.x);
                PlayerPrefs.SetFloat("DeskLeftY", DeskLeft.y);
                PlayerPrefs.SetFloat("DeskLeftZ", DeskLeft.z);

                ContentHolder.transform.position = AttachReference.transform.position;

                // Change instructions
                Ins5.SetActive(false);
                Ins6.SetActive(true);
            }

            // Desk back
            if (BuildStage == 5 && Building == true)
            {
                DeskBack = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);

                _deskBuilder.UpdateDeskBack(DeskBack);

                // Save values
                PlayerPrefs.SetFloat("DeskBackX", DeskBack.x);
                PlayerPrefs.SetFloat("DeskBackY", DeskBack.y);
                PlayerPrefs.SetFloat("DeskBackZ", DeskBack.z);

                // Change instructions
                Ins6.SetActive(false);
                Ins7.SetActive(true);
            }

            // Button 1
            if (BuildStage == 6 && Building == true)
            {
                Button1.SetActive(true);

                Button1Pos = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);
                _deskBuilder.UpdateButton1(Button1Pos);

                // Save values
                PlayerPrefs.SetFloat("Button1X", Button1Pos.x);
                PlayerPrefs.SetFloat("Button1Y", Button1Pos.y);
                PlayerPrefs.SetFloat("Button1Z", Button1Pos.z);

                // Change instructions
                Ins7.SetActive(false);
                Ins8.SetActive(true);
            }

            // Button 2
            if (BuildStage == 7 && Building == true)
            {
                Button2.SetActive(true);

                Button2Pos = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);
                _deskBuilder.UpdateButton2(Button2Pos);

                // Save values
                PlayerPrefs.SetFloat("Button2X", Button2Pos.x);
                PlayerPrefs.SetFloat("Button2Y", Button2Pos.y);
                PlayerPrefs.SetFloat("Button2Z", Button2Pos.z);

                // Change instructions
                Ins8.SetActive(false);
                Ins9.SetActive(true);
            }

            // Button 3
            if (BuildStage == 8 && Building == true)
            {
                Button3.SetActive(true);

                Button3Pos = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);
                _deskBuilder.UpdateButton3(Button3Pos);

                // Save values
                PlayerPrefs.SetFloat("Button3X", Button3Pos.x);
                PlayerPrefs.SetFloat("Button3Y", Button3Pos.y);
                PlayerPrefs.SetFloat("Button3Z", Button3Pos.z);

                // Change instructions
                Ins9.SetActive(false);
                Ins10.SetActive(true);
            }

            // Button 4
            if (BuildStage == 9 && Building == true)
            {
                Button4.SetActive(true);

                Button4Pos = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);
                _deskBuilder.UpdateButton4(Button4Pos);

                // Save values
                PlayerPrefs.SetFloat("Button4X", Button4Pos.x);
                PlayerPrefs.SetFloat("Button4Y", Button4Pos.y);
                PlayerPrefs.SetFloat("Button4Z", Button4Pos.z);

                // Change instructions
                Ins10.SetActive(false);
                Ins11.SetActive(true);
            }

            // Chair position
            if (BuildStage == 10 && Building == true)
            {
                Chair.SetActive(true);

                ChairYrot = ReturnReferencePosition().transform.eulerAngles.y;

                ChairPosition = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);

                _chairBuilder.UpdateChairPosition(ChairPosition, ChairYrot);

                // Save values
                PlayerPrefs.SetFloat("ChairPositionX", ChairPosition.x);
                PlayerPrefs.SetFloat("ChairPositionY", ChairPosition.y);
                PlayerPrefs.SetFloat("ChairPositionZ", ChairPosition.z);

                PlayerPrefs.SetFloat("ChairRotationY", ChairYrot);

                // Change instructions
                Ins11.SetActive(false);
                Ins12.SetActive(true);
            }

            // Chair height
            if (BuildStage == 11 && Building == true)
            {
                ChairHeight = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);

                _chairBuilder.UpdateChairHeight(ChairHeight);

                // Save values
                PlayerPrefs.SetFloat("ChairHeightX", ChairHeight.x);
                PlayerPrefs.SetFloat("ChairHeightY", ChairHeight.y);
                PlayerPrefs.SetFloat("ChairHeightZ", ChairHeight.z);

                // Change instructions
                Ins12.SetActive(false);
                Ins13.SetActive(true);
            }

            // Chair right
            if (BuildStage == 12 && Building == true)
            {
                ChairRight = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);

                _chairBuilder.UpdateChairRight(ChairRight);

                // Save values
                PlayerPrefs.SetFloat("ChairRightX", ChairRight.x);
                PlayerPrefs.SetFloat("ChairRightY", ChairRight.y);
                PlayerPrefs.SetFloat("ChairRightZ", ChairRight.z);

                // Change instructions
                Ins13.SetActive(false);
                Ins14.SetActive(true);
            }

            // Chair left
            if (BuildStage == 13 && Building == true)
            {
                ChairLeft = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);

                _chairBuilder.UpdateChairLeft(ChairLeft);

                // Save values
                PlayerPrefs.SetFloat("ChairLeftX", ChairLeft.x);
                PlayerPrefs.SetFloat("ChairLeftY", ChairLeft.y);
                PlayerPrefs.SetFloat("ChairLeftZ", ChairLeft.z);

                // Change instructions
                Ins14.SetActive(false);
                Ins15.SetActive(true);
            }

            // Chair back
            if (BuildStage == 14 && Building == true)
            {
                ChairBack = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);

                _chairBuilder.UpdateChairBack(ChairBack);

                // Save values
                PlayerPrefs.SetFloat("ChairBackX", ChairBack.x);
                PlayerPrefs.SetFloat("ChairBackY", ChairBack.y);
                PlayerPrefs.SetFloat("ChairBackZ", ChairBack.z);

                // Change instructions
                Ins15.SetActive(false);
                Ins16.SetActive(true);
            }

            // Chair back height
            if (BuildStage == 15 && Building == true)
            {
                ChairBackHeight = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);

                _chairBuilder.UpdateChairBackHeight(ChairBackHeight);

                // Save values
                PlayerPrefs.SetFloat("ChairBackHeightX", ChairBackHeight.x);
                PlayerPrefs.SetFloat("ChairBackHeightY", ChairBackHeight.y);
                PlayerPrefs.SetFloat("ChairBackHeightZ", ChairBackHeight.z);

                // Change instructions
                Ins16.SetActive(false);
                InstructionCanvas.SetActive(false);

                // Save object positions
                CombineScene();

                PlayerPrefs.SetInt("IsSavedData", 1);

                LaserPointer.SetActive(true);
            }

            if (BuildStage > 15 && Building == true)
            {
                ResetGlobalPosition();
                LaserPointer.SetActive(true);
            }

            if (Building == true)
            {
                BuildStage++;
            }
        }
    }