private void RightGripPressed(object sender, VRTK.ControllerInteractionEventArgs e) { if (curObj != null) { curObj.Destroy(); sceneManager.objects.Remove(curObj); curObj = null; } }
public void OnLeave(IState nextState) { sceneManager.rightEvents.TriggerPressed -= rightTriggerPressed; sceneManager.rightEvents.GripPressed -= rightGripPressed; if (obj != null && status != STATUS.FINISH) { obj.Destroy(); } ResetStatus(); activeEdges = null; obj = null; }
private void RightTriggerPressed(object sender, VRTK.ControllerInteractionEventArgs e) { switch (status) { case STATUS.SELECT: if (sceneManager.activeEntity.obj != null) { SelectObject(sceneManager.activeEntity.obj); status = STATUS.CUT; quad.SetActive(true); } break; case STATUS.CUT: List <MObject> objects = curObj.PlaneSplit(quad.transform.TransformDirection(Vector3.forward).normalized, quad.transform.TransformPoint(Vector3.zero)); if (objects.Count > 1) { sceneManager.objects.Remove(curObj); foreach (MObject obj in objects) { sceneManager.objects.Add(obj); } curObj.Destroy(); curObj = null; sceneManager.sceneStateMachine.SwitchState((uint)SceneManager.SceneStatus.TRANSFORM, null); } else { foreach (MObject obj in objects) { obj.Destroy(); } } break; } }