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); } }
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 Update() { //GIZMO TYPE CHANGE 1: TRANSFORM 2: ROTATION 3: SCALE if (SelectedTransformGizmos != null && SelectedGameObject != null) { updateTransformBar(); if (Input.GetKeyDown(KeyCode.Alpha1)) { SelectedTransformGizmos.TurnOnTransformationOptionGizmo(); } if (Input.GetKeyDown(KeyCode.Alpha2)) { SelectedTransformGizmos.TurnOnRotationOptionGizmo(); } if (Input.GetKeyDown(KeyCode.Alpha3)) { SelectedTransformGizmos.TurnOnScaleOptionGizmo(); } } }
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; } }