Ejemplo n.º 1
0
        private bool drawGizmo(objectType type, GameObject gameObj)
        {
            if (SelectedGameObject != null && SelectedTransformGizmos != null)
            {
                if (SelectedTransformGizmos.SelectedType == TransformGizmos.MOVETYPE.NONE)
                {
                    SelectedTransformGizmos.TurnOffGizmos();
                    Destroy(SelectedGameObject.GetComponent <TransformGizmos>());
                    SelectedGameObject = null;
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                if (type == objectType.object3d || type == objectType.cameraVan)
                {
                    SelectedGameObject = gameObj;
                    SelectedGameObject.AddComponent <TransformGizmos>();
                    SelectedTransformGizmos = SelectedGameObject.GetComponent <TransformGizmos>();
                    SelectedTransformGizmos.TurnOnTransformationOptionGizmo();
                }

                return(false);
            }
        }
Ejemplo n.º 2
0
    void NonDynamically()
    {
        Ray        CameraRay = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (Input.GetMouseButtonDown(0))
        {
            if (SelectedGameObject != null)
            {
                if (SelectedTransformGizmos != null)
                {
                    if (SelectedTransformGizmos.SelectedType == TransformGizmos.MOVETYPE.NONE)
                    {
                        SelectedTransformGizmos.TurnOffGizmos();
                        SelectedGameObject.GetComponent <Renderer>().material = StartMaterial;
                        SelectedTransformGizmos = null;
                        SelectedGameObject      = null;
                    }
                }
            }
            if (Physics.Raycast(CameraRay, out hit, 50))
            {
                if (hit.collider.gameObject != null && hit.collider.gameObject != SelectedGameObject)
                {
                    SelectedGameObject = hit.collider.gameObject;
                    if (SelectedGameObject.GetComponent <TransformGizmos> ())
                    {
                        SelectedTransformGizmos = SelectedGameObject.GetComponent <TransformGizmos> ();
                        SelectedTransformGizmos.TurnOnTransformationOptionGizmo();
                        StartMaterial          = SelectedGameObject.GetComponent <Renderer>().material;
                        SelectedMaterial.color = StartMaterial.color;
                        SelectedGameObject.GetComponent <Renderer>().material = SelectedMaterial;
                    }
                }
            }
        }

        if (SelectedGameObject != null && SelectedTransformGizmos != null)
        {
            if (Input.GetKeyDown(TransformationOption))
            {
                SelectedTransformGizmos.TurnOnTransformationOptionGizmo();
            }
            if (Input.GetKeyDown(RotationOption))
            {
                SelectedTransformGizmos.TurnOnRotationOptionGizmo();
            }

            if (Input.GetKeyDown(ScaleOption))
            {
                SelectedTransformGizmos.TurnOnScaleOptionGizmo();
            }
        }
    }
    void Awake()
    {
        transformGizmos                 = myCamera.GetComponent <TransformGizmos>();
        inputFields                     = inspectorPanel.GetComponentsInChildren <InputField>();
        panelManager                    = panelManagerObject.GetComponent <PanelManager>();
        textureManager                  = textureManagerObject.GetComponent <TextureManager>();
        pointer                         = controller.GetComponent <VRTK_Pointer>();
        vrtk_ControllerEvents           = controller.GetComponent <VRTK_ControllerEvents>();
        pointer.DestinationMarkerEnter += OnPointerEnter;
        pointer.DestinationMarkerExit  += OnPointerExit;
        headerText                      = header.GetComponentsInChildren <Text>()[0];
        interactGrab                    = controller.GetComponent <VRTK_InteractGrab> ();

        mainTextureButton.onClick.AddListener(OnMainTextureButtonClick);
        bumpMapButton.onClick.AddListener(OnBumpMapButtonClick);

        // pointer.DestinationMarkerHover += OnPointerEnter;
    }
Ejemplo n.º 4
0
 public void clickChangeMode(Button btn)
 {
     if (camControl.mode == CameraController.CameraMode.freeFlyMode)
     {
         if (camControl.target == null)
         {
             Alert alertdialog = new Alert();
             alertdialog.openInteractableAlertDialog("ERROR", "No Camera Van was detected. Please use 'Object Bar' at the bottom of screen to add a Camera Van.");
             return;
         }
         else
         {
             btn.image.sprite = Resources.Load <Sprite>("Textures/Menu/AddObjectMenu/RecordModeIcon");
             camControl.mode  = CameraController.CameraMode.recordMode;
             camControl.cameraUpdate();
             camControl.target.GetComponent <Rigidbody>().useGravity = true;
             EditModeCanvas.SetActive(false);
             cameraVanEditMenu.SetActive(true);
             cameraVanEditMenu.transform.Find("Panel").Find("ButtonClose").GetComponent <Button>().interactable   = false;
             cameraVanEditMenu.transform.Find("Panel").Find("ButtonDestroy").GetComponent <Button>().interactable = false;
             TransformGizmos tg = camControl.target.GetComponent <TransformGizmos>();
             if (tg != null)
             {
                 tg.TurnOffGizmos();
                 Destroy(camControl.target.GetComponent <TransformGizmos>());
             }
         }
     }
     else if (camControl.mode == CameraController.CameraMode.recordMode)
     {
         btn.image.sprite = Resources.Load <Sprite>("Textures/Menu/AddObjectMenu/EditModeIcon");
         camControl.mode  = CameraController.CameraMode.freeFlyMode;
         camControl.cameraUpdate();
         EditModeCanvas.SetActive(true);
         cameraVanEditMenu.SetActive(false);
         cameraVanEditMenu.transform.Find("Panel").Find("ButtonClose").GetComponent <Button>().interactable   = true;
         cameraVanEditMenu.transform.Find("Panel").Find("ButtonDestroy").GetComponent <Button>().interactable = true;
     }
 }
    void NonDynamically()
    {
        Ray CameraRay = Camera.main.ScreenPointToRay (Input.mousePosition);
        RaycastHit hit;
        if (Input.GetMouseButtonDown (0)){

            if(SelectedGameObject!=null){

                if(SelectedTransformGizmos !=null){
                    if(SelectedTransformGizmos.SelectedType == TransformGizmos.MOVETYPE.NONE){
                        SelectedTransformGizmos.TurnOffGizmos();
                        SelectedGameObject.GetComponent<Renderer>().material = StartMaterial;
                        SelectedTransformGizmos = null;
                        SelectedGameObject = null;
                    }
                }

            }
            if (Physics.Raycast (CameraRay, out hit, 50)) {
                if (hit.collider.gameObject != null && hit.collider.gameObject != SelectedGameObject) {

                    SelectedGameObject = hit.collider.gameObject;
                    if (SelectedGameObject.GetComponent<TransformGizmos> ()) {
                        SelectedTransformGizmos = SelectedGameObject.GetComponent<TransformGizmos> ();
                        SelectedTransformGizmos.TurnOnTransformationOptionGizmo();
                        StartMaterial = SelectedGameObject.GetComponent<Renderer>().material;
                        SelectedMaterial.color =StartMaterial.color;
                        SelectedGameObject.GetComponent<Renderer>().material = SelectedMaterial;

                    }

                }

            }
        }

        if (SelectedGameObject != null && SelectedTransformGizmos !=null) {

            if(Input.GetKeyDown(TransformationOption)){
                SelectedTransformGizmos.TurnOnTransformationOptionGizmo();
            }
            if(Input.GetKeyDown(RotationOption)){
                SelectedTransformGizmos.TurnOnRotationOptionGizmo();
            }

            if(Input.GetKeyDown(ScaleOption)){
                SelectedTransformGizmos.TurnOnScaleOptionGizmo();
            }

        }
    }
        private bool drawGizmo(objectType type, GameObject gameObj)
        {
            if (SelectedGameObject != null && SelectedTransformGizmos != null)
            {
                if (SelectedTransformGizmos.SelectedType == TransformGizmos.MOVETYPE.NONE)
                {
                    SelectedTransformGizmos.TurnOffGizmos();
                    Destroy(SelectedGameObject.GetComponent<TransformGizmos>());
                    SelectedGameObject = null;
                    return false;
                }
                else
                    return true;

            }
            else
            {
                if (type == objectType.object3d || type == objectType.cameraVan)
                {
                    SelectedGameObject = gameObj;
                    SelectedGameObject.AddComponent<TransformGizmos>();
                    SelectedTransformGizmos = SelectedGameObject.GetComponent<TransformGizmos>();
                    SelectedTransformGizmos.TurnOnTransformationOptionGizmo();

                }

                return false;
            }
        }