void performToggleAction(DiageticToggle toggle) { if (toggle.toggleType == "dimensionality") { bool newDimensionality = toggle.switchState(); if (newDimensionality) { graphGenerator.changeNodeDimensionality(GenerateGraph.GRAPH_3D); } else { graphGenerator.changeNodeDimensionality(GenerateGraph.GRAPH_2D); } } }
void Start() { GameObject prefabLineToRender = Resources.Load("Line") as GameObject; GameObject lineToRender = Instantiate(prefabLineToRender, new Vector3(0, 0, 0), Quaternion.identity) as GameObject; myLineRenderer = lineToRender.GetComponent <LineRenderer>(); myLineRenderer.enabled = false; graphGenerator = this.gameObject.GetComponent <GenerateGraph>(); toggle3DCollider = toggle3DGameObject.GetComponent <Collider>(); toggle3Dscript = toggle3DGameObject.GetComponent <DiageticToggle>(); slider1Collider = slider1.GetComponent <Collider>(); slider1script = slider1.GetComponent <DiageticSlider>(); sliderFollowersCollider = sliderFollowers.GetComponent <Collider>(); sliderFollowersScript = sliderFollowers.GetComponent <DiageticSlider>(); }
void UpdateToggleState(Collider collider, DiageticToggle toggle, Ray ray, Vector3 heading, Vector3 p, bool isActive, string handedness) { RaycastHit hit = new RaycastHit(); if (toggle.state != toggle.DRAGGING && isActive && collider.Raycast(ray, out hit, 200.0f)) { // start a drag toggle.state = toggle.DRAGGING; toggle.OnGrab(); toggle.handUsed = handedness; // do things related to starting a drag } if (toggle.state == toggle.DRAGGING && toggle.handUsed == handedness) { if (!isActive) { // no longer dragging toggle.state = toggle.NORMAL; performToggleAction(toggle); } } }
void Start() { GameObject prefabLineToRender = Resources.Load("Line") as GameObject; GameObject lineToRender = Instantiate(prefabLineToRender, new Vector3(0, 0, 0), Quaternion.identity) as GameObject; myLineRenderer = lineToRender.GetComponent<LineRenderer>(); myLineRenderer.enabled = false; graphGenerator = this.gameObject.GetComponent<GenerateGraph>(); toggle3DCollider = toggle3DGameObject.GetComponent<Collider>(); toggle3Dscript = toggle3DGameObject.GetComponent<DiageticToggle>(); slider1Collider = slider1.GetComponent<Collider>(); slider1script = slider1.GetComponent<DiageticSlider>(); sliderFollowersCollider = sliderFollowers.GetComponent<Collider>(); sliderFollowersScript = sliderFollowers.GetComponent<DiageticSlider>(); }
void performToggleAction(DiageticToggle toggle) { if (toggle.toggleType == "dimensionality") { bool newDimensionality = toggle.switchState(); if (newDimensionality) { graphGenerator.changeNodeDimensionality(GenerateGraph.GRAPH_3D); } else { graphGenerator.changeNodeDimensionality(GenerateGraph.GRAPH_2D); } } }