public override void setState(manipState state) { if (curState == state) { return; } if (curState == manipState.grabbed) { transform.parent = masterObj; glowTrans.gameObject.SetActive(false); returnRoutineID = StartCoroutine(returnRoutine()); if (_interface != null) { _interface.onGrab(false, -1); } } curState = state; if (curState == manipState.none) { highlight.SetActive(false); } else if (curState == manipState.selected) { highlight.SetActive(true); } else if (curState == manipState.grabbed) { if (_interface != null) { _interface.onGrab(true, -1); } if (returnRoutineID != null) { StopCoroutine(returnRoutineID); } highlight.SetActive(false); glowTrans.gameObject.SetActive(true); transform.parent = manipulatorObj.parent; transform.localPosition = Vector3.zero; transform.localRotation = Quaternion.identity; if (manipulatorObjScript != null) { manipulatorObjScript.setVerticalPosition(transform); } pads.Clear(); lastStickPos.Clear(); pads = FindObjectsOfType <drumpad>().ToList(); for (int i = 0; i < pads.Count; i++) { lastStickPos.Add(pads[i].transform.parent.InverseTransformPoint(sticktip.position)); } } }
public override void setState(manipState state) { if (curState == manipState.grabbed) { if (_interface != null) { _interface.onGrab(false, 0); } } curState = state; if (curState == manipState.none) { if (_interface != null) { _interface.onSelect(false, ID); } if (usingGlowMat) { rend.material = offMat; } else { rend.material.SetColor("_TintColor", glowColor * 0.25f); } } else if (curState == manipState.selected) { if (_interface != null) { _interface.onSelect(true, ID); } if (usingGlowMat) { rend.material = glowMat; glowMat.SetColor("_TintColor", glowColor * .25f); } else { rend.material.SetColor("_TintColor", glowColor * 0.5f); } } else if (curState == manipState.grabbed) { if (_interface != null) { _interface.onSelect(true, ID); } if (usingGlowMat) { rend.material = glowMat; } else { rend.material.SetColor("_TintColor", glowColor * 0.5f); } posstart = (Vector2)transform.localPosition; offset.x = transform.localPosition.x - transform.parent.InverseTransformPoint(manipulatorObj.position).x; offset.y = transform.localPosition.y - transform.parent.InverseTransformPoint(manipulatorObj.position).y; if (_interface != null) { _interface.onGrab(true, 0); } } }