// subscribed to LaserPointer PointClick event, for 'ray' collision with an object private void OnPointerClick(object sender, PointerEventArgs e) { //clear path //var path = GameObject.FindGameObjectsWithTag("arcPath"); //foreach (GameObject p in path) //{ // Destroy(p); //} // get the collided object GameObject obj = e.target.gameObject; Debug.Log(obj.name); // check if the collided object is a state, and flip its status if it is StateColor stateColor = obj.GetComponent <StateColor>(); if (stateColor) { stateColor.StateToggle(); if (arcDrawer) { arcDrawer.ClearPath(); arcDrawer.ToggleState(obj.name); } //UpdateArcs(); } }
// subscribed to LaserPointer PointerOut event, used to end highlight private void OnPointerOut(object sender, PointerEventArgs e) { StateColor stateColor = e.target.GetComponent <StateColor>(); if (stateColor) { stateColor.HoverStop(); } }