void RightControllerEvents_GripUp(object sender, VRTK.ControllerInteractionEventArgs e) { if (CurrentGameMode == GameMode.DELETE) { ChangeGameMode(GameMode.BUILD); } }
protected override void DisablePointerBeam(object sender, ControllerInteractionEventArgs e) { base.PointerSet(); base.DisablePointerBeam(sender, e); TogglePointerCursor(false); curvedBeam.TogglePoints(false); }
private void StartShooting(object sender, VRTK.ControllerInteractionEventArgs e) { if (!TimeManager.IsPaused) { muzzleFlash.SetActive(true); } }
private void DoTriggerPressed(object sender, VRTK.ControllerInteractionEventArgs e) { if (TAPE.activeInHierarchy) { FwdPressed = true; } }
private void LeftTouchpadAxisChanged(object sender, VRTK.ControllerInteractionEventArgs e) { float newX = e.touchpadAxis.x; controllerMenu.transform.Rotate(Vector3.forward, (lastX - newX) * 90); lastX = newX; }
void DoTriggerClicked(object sender, VRTK.ControllerInteractionEventArgs e) { orbitals[counter].SetActive(true); orbitals[counter].transform.position = gameObject.transform.position; orbitals[counter].transform.rotation = gameObject.transform.rotation; var orbital = orbitals[counter].GetComponent <Move>(); orbital.Launch(); orbital.initialTangent = gameObject.transform.up; counter++; if (counter > numObjs - 1) { counter = 0; for (int i = 0; i < numObjs; i++) { var orb = GameObject.Instantiate(prefab); orb.SetActive(false); var move = orb.GetComponent <Move>(); move.indexNum = i + 1; move.orbitCenter = GameObject.Find("Camera (eye)"); orbitals[i] = orb; } } }
void DoTouchpadPressed(object sender, ControllerInteractionEventArgs e) { for (int i = 0; i < 20; i++) { Instantiate(spawnMe, position, Quaternion.identity); } }
/// <summary> /// TouchChange /// </summary> /// <param name="o"></param> /// <param name="e"></param> public void TouchChange(object o, VRTK.ControllerInteractionEventArgs e) { Vector3 forwardVector = camTransform.forward * e.touchpadAxis.y; Vector3 sideVector = camTransform.right * e.touchpadAxis.x; moveVector = forwardVector + sideVector; }
private void RightTriggerPressed(object sender, VRTK.ControllerInteractionEventArgs e) { if (sceneManager.activeEntity.obj != null) { SelectObject(sceneManager.activeEntity.obj); } }
void LeftControllerEvents_GripUp(object sender, VRTK.ControllerInteractionEventArgs e) { // Only clear the current save slot in delete mode if (CurrentGameMode == GameMode.DELETE) { World.Instance.ClearCurrentSaveSlot(); } }
void RightControllerEvents_GripDown(object sender, VRTK.ControllerInteractionEventArgs e) { // This is only possible if the user is not in draw mode already if (CurrentGameMode != GameMode.DRAW) { ChangeGameMode(GameMode.DELETE); } }
private void LeftTriggerReleased(object sender, VRTK.ControllerInteractionEventArgs e) { if (scaling) { scaling = false; } leftPressed = false; }
private void DoStopUseObject(object sender, ControllerInteractionEventArgs e) { if (IsObjectHoldOnUse(usingObject) || GetObjectUsingState(usingObject) >= 2) { SetObjectUsingState(usingObject, 0); UnuseInteractedObject(); } }
private void RightGripPressed(object sender, VRTK.ControllerInteractionEventArgs e) { if (curObj != null) { curObj.ExportObject(System.DateTime.Now.ToFileTime().ToString()); SelectObject(null); } }
private void OnTriggerUnclicked(object sender, VRTK.ControllerInteractionEventArgs e) { triggerDown = false; if (tool != null) { tool.OnMouseUp(0, hitdat, lastdt, toolRadius, placeablePrefab); } }
private void RightTriggerPressed(object sender, VRTK.ControllerInteractionEventArgs e) { if (sceneManager.activeEntity.entity != null) { SelectEntity(sceneManager.activeEntity); UpdateText(); } }
private void DoTriggerReleased(object sender, ControllerInteractionEventArgs e) { tooltips.ShowTips(false, VRTK_ControllerTooltips.TooltipButtons.TriggerTooltip); actions.ToggleHighlightTrigger(false); if (!events.AnyButtonPressed()) { actions.SetControllerOpacity(1f); } }
void DoMenuOn(object sender, ControllerInteractionEventArgs e) { if (!menuInit) { InitMenu(); } clonedMenuObject.SetActive(true); menuActive = true; }
private void RightGripPressed(object sender, VRTK.ControllerInteractionEventArgs e) { if (selectEntity != null) { curObj.RemoveEntity(selectEntity); } selectEntity = null; SelectObject(null); }
private void RightGripPressed(object sender, VRTK.ControllerInteractionEventArgs e) { if (curObj != null) { curObj.Destroy(); sceneManager.objects.Remove(curObj); curObj = null; } }
private void OnTriggerPressed(object sender, VRTK.ControllerInteractionEventArgs e) { var bulletClone = PhotonNetwork.Instantiate(bullet.name, bulletSpawn.transform.position, bulletSpawn.transform.rotation, 0) as GameObject; bulletClone.SetActive(true); Rigidbody rb = bulletClone.GetComponent <Rigidbody>(); rb.AddForce(-bulletSpawn.transform.forward * bulletSpeed); Destroy(bulletClone, bulletLife); }
private void RightTriggerPressed(object sender, VRTK.ControllerInteractionEventArgs e) { if (sceneManager.pointerOnMenu) { return; } curObject.transform.parent = null; sceneManager.objects.Add(curObject); sceneManager.sceneStateMachine.SwitchState((uint)SceneManager.SceneStatus.TRANSFORM, null); }
private void Teleport(object sender, VRTK.ControllerInteractionEventArgs e) { Ray ray = new Ray(transform.position, transform.forward); RaycastHit hit; if (Physics.Raycast(ray, out hit, 10000f, layerMask)) { teleporter.Teleport(hit.transform, hit.point); } }
private void OnTeleportButtonPressed(object sender, VRTK.ControllerInteractionEventArgs e) { Debug.Log("Is state valid? " + pointer.IsStateValid()); if (pointer.IsStateValid()) { Debug.Log("Attempting to teleport"); camRig.position = pointer.pointerRenderer.GetDestinationHit().point; //teleporter.Teleport(null, pointer.pointerRenderer.GetDestinationHit().point); Debug.Log("Teleported to:" + camRig.position); } }
private void OnPlaceButtonPressed(object sender, VRTK.ControllerInteractionEventArgs e) { Debug.Log("Is state valid? " + pointer.IsStateValid()); if (pointer.IsStateValid()) { GameObject obj = Instantiate(prefab); obj.transform.position = pointer.pointerRenderer.GetDestinationHit().point; obj.transform.eulerAngles = Vector3.up * Random.Range(0f, 360f); Debug.Log("Created object & set position to:" + obj.transform.position); } }
private void DoTouchpadReleased(object sender, ControllerInteractionEventArgs e) { if (roomExtender.additionalMovementEnabledOnButtonPress) { DisableAdditionalMovement(); } else { EnableAdditionalMovement(); } }
private void LeftTouchpadTouchEnd(object sender, VRTK.ControllerInteractionEventArgs e) { if (e.touchpadAxis.x - lastX >= MDefinitions.TOUCHPAD_AXIS_CHANGE_THRESHOLD) { PrevPage(); } else if (lastX - e.touchpadAxis.x >= MDefinitions.TOUCHPAD_AXIS_CHANGE_THRESHOLD) { NextPage(); } }
private void DoTouchpadPressed(object sender, ControllerInteractionEventArgs e) { roomExtender.additionalMovementMultiplier = e.touchpadAxis.magnitude * 5 > 1 ? e.touchpadAxis.magnitude * 5 : 1; if (roomExtender.additionalMovementEnabledOnButtonPress) { EnableAdditionalMovement(); } else { DisableAdditionalMovement(); } }
private void DoStartUseObject(object sender, ControllerInteractionEventArgs e) { GameObject touchedObject = interactTouch.GetTouchedObject(); if (touchedObject != null && interactTouch.IsObjectInteractable(touchedObject)) { UseInteractedObject(touchedObject); if (!IsObjectHoldOnUse(usingObject)) { SetObjectUsingState(usingObject, GetObjectUsingState(usingObject) + 1); } } }
// ---------------------------- // Functions that use Block Copy // ---------------------------- void client_send_reliable_message(object sender, VRTK.ControllerInteractionEventArgs e) { Debug.Log("CLICKED"); if (current_player == 1) { n_manager_script.server_send_reliable(); } else { n_manager_script.client_send_reliable(); } }
private void RightTriggerReleased(object sender, VRTK.ControllerInteractionEventArgs e) { if (transforming) { curObj.transform.parent = null; transforming = false; } else if (scaling) { scaling = false; } rightPressed = false; }
private void RightTriggerPressed(object sender, VRTK.ControllerInteractionEventArgs e) { if (sceneManager.activeEntity.obj != null && !leftPressed) // 移动&旋转 { SelectObject(sceneManager.activeEntity.obj); curObj.transform.parent = sceneManager.rightController.transform; transforming = true; } else { rightPressed = true; } }
//Touchpad finger moved position private void DoTouchpadAxisChanged(object sender, ControllerInteractionEventArgs e) { //Convert Touchpad Vector2 to Angle (0 to 360) float angle = Mathf.Atan2(e.touchpadAxis.y, e.touchpadAxis.x) * Mathf.Rad2Deg; angle = 90.0f - angle; if (angle < 0) { angle += 360.0f; } currentAngle = 360 - angle; menu.HoverButton(currentAngle); }
private void DoApplicationMenuPressed(object sender, ControllerInteractionEventArgs e) { switch (roomExtender.movementFunction) { case VRTK_RoomExtender.MovementFunction.Nonlinear: roomExtender.movementFunction = VRTK_RoomExtender.MovementFunction.LinearDirect; break; case VRTK_RoomExtender.MovementFunction.LinearDirect: roomExtender.movementFunction = VRTK_RoomExtender.MovementFunction.Nonlinear; break; default: break; } }
private void RightTriggerPressed(object sender, VRTK.ControllerInteractionEventArgs e) { if (sceneManager.activeEntity.entity != null) { MEdge edge = sceneManager.activeEntity.entity as MEdge; if (edge.edgeType == MEdge.MEdgeType.LINEAR) { MLinearEdge refEdge = sceneManager.activeEntity.obj.refEdge; if (refEdge != null) { refEdge.entityStatus = MEntity.MEntityStatus.DEFAULT; } sceneManager.activeEntity.obj.SetRefEdge((MLinearEdge)edge); edge.entityStatus = MEntity.MEntityStatus.SPECIAL; } } }
private void RightTriggerPressed(object sender, VRTK.ControllerInteractionEventArgs e) { if (sceneManager.pointerOnMenu) { return; } if (curObj == null) { if (sceneManager.activeEntity.obj != null) { SelectObject(sceneManager.activeEntity.obj); } } else { curObj.CreatePoint(activePoint.position); } }
void RightControllerEvents_TriggerDown(object sender, VRTK.ControllerInteractionEventArgs e) { if (RightInteractGrab.GetGrabbedObject() != null || // If we already have an object that we have grabbed RightInteractTouch.GetTouchedObject() != null) // .. or if we are touching an interactable object { return; } if (RightInteractNearTouch.GetNearTouchedObjects().Count > 0) // If we near interactable objects { if (ValidateNearObjects()) { return; } } ChangeGameMode(GameMode.DRAW); }
private void RightTriggerPressed(object sender, VRTK.ControllerInteractionEventArgs e) { if (sceneManager.activeEntity.entity != null && ((MEdge)sceneManager.activeEntity.entity).edgeType == MEdge.MEdgeType.LINEAR) { if (curObject == null) { curObject = sceneManager.activeEntity.obj; } else { if (sceneManager.activeEntity.obj != curObject) { ResetStatus(); return; } } MLinearEdge le = sceneManager.activeEntity.entity as MLinearEdge; if (selectEdges.Count > 1) { Vector3 normal = Vector3.Cross(selectEdges[0].direction, selectEdges[1].direction).normalized; if (!MHelperFunctions.Perpendicular(normal, le.direction)) { ResetStatus(); return; } } SelectEdge(le); if (selectEdges.Count < 3) { curObject = null; return; } MPolygonFace face = new MPolygonFace(selectEdges); if (face.IsValid()) { curObject.CreatePolygonFace(new List <MLinearEdge>(selectEdges)); ResetStatus(); } } else { ResetStatus(); } }
private void RightTriggerPressed(object sender, VRTK.ControllerInteractionEventArgs e) { switch (status) { case STATUS.DEFAULT: obj.transform.position = sceneManager.rightControllerPosition; stablePoint = obj.worldToLocalMatrix.MultiplyPoint(sceneManager.rightControllerPosition); status = STATUS.CREATE_EDGE; activeEdges[0] = new MLinearEdge(new MPoint(stablePoint), new MPoint(activePoint.position)); activeEdges[0].end.edges.Add(activeEdges[0]); break; case STATUS.CREATE_EDGE: activeEdges[1] = new MLinearEdge(activeEdges[0].start, new MPoint(activePoint.position + activeEdges[0].start.position - activeEdges[0].end.position)); activeEdges[1].end.edges.Add(activeEdges[1]); activeEdges[2] = new MLinearEdge(activeEdges[0].end, new MPoint(activePoint.position)); activeEdges[2].end.edges.Add(activeEdges[2]); activeEdges[3] = new MLinearEdge(activeEdges[1].end, activeEdges[2].end); activeEdges[3].start.edges.Add(activeEdges[3]); activeEdges[3].end.edges.Add(activeEdges[3]); activeFace = new MPolygonFace(new List <MLinearEdge>(activeEdges)); activeEdges[1].faces.Add(activeFace); activeEdges[2].faces.Add(activeFace); activeEdges[3].faces.Add(activeFace); activeTextMesh.SetActive(true); status = STATUS.STRETCH; break; case STATUS.STRETCH: if (activeFace != null && activeFace.IsValid()) { status = STATUS.FINISH; obj.CreatePolygonFace(new List <MLinearEdge>(activeEdges)); sceneManager.objects.Add(obj); sceneManager.sceneStateMachine.SwitchState((uint)SceneManager.SceneStatus.TRANSFORM, null); } else { ResetStatus(); } break; } }
private void Snap(object sender, VRTK.ControllerInteractionEventArgs e) { if (UserInputHandler.laserPointedActor != null) //if we are pointing at something { if (UserInputHandler.laserPointedActor.CompareTag("Actor")) //If it is an actor { Vector3 pos = UserInputHandler.laserPointedActor.position; if ((pos.x > (transform.position.x - scale.x / 2)) && (UserInputHandler.laserPointedActor.position.x < (transform.position.x + scale.x / 2)) && (UserInputHandler.laserPointedActor.position.z > (transform.position.z - scale.y / 2)) && (UserInputHandler.laserPointedActor.position.z < (transform.position.z + scale.y / 2))) //if it is already in focus area { //Take the actor back to the original position Debug.Log("Un-snapping " + UserInputHandler.laserPointedActor.name + " out of focus area."); UserInputHandler.laserPointedActor.position = UserInputHandler.laserPointedActor.GetComponent <ActorFunctionality>().originalPosition; } else { //Code for snapping UserInputHandler.laserPointedActor.GetComponent <ActorFunctionality>().originalPosition = UserInputHandler.laserPointedActor.position; //Reset the original position if in case the actor has been moved UserInputHandler.laserPointedActor.position = transform.position + new Vector3(Random.Range(-scale.x, scale.x) / 2, 1.7f, Random.Range(-scale.y, scale.y) / 2); Debug.Log("Snapping " + UserInputHandler.laserPointedActor.name + " into focus area."); } } } }
public virtual void OnApplicationMenuReleased(ControllerInteractionEventArgs e) { if (ApplicationMenuReleased != null) ApplicationMenuReleased(this, e); }
public virtual void OnAliasPointerSet(ControllerInteractionEventArgs e) { if (AliasPointerSet != null) AliasPointerSet(this, e); }
public virtual void OnAliasUseOn(ControllerInteractionEventArgs e) { if (AliasUseOn != null) AliasUseOn(this, e); }
void DoTriggerReleased(object sender, ControllerInteractionEventArgs e) { rcCarScript.SetTriggerAxis(0f); }
public virtual void OnAliasMenuOff(ControllerInteractionEventArgs e) { if (AliasMenuOff != null) AliasMenuOff(this, e); }
public virtual void OnTouchpadTouchStart(ControllerInteractionEventArgs e) { if (TouchpadTouchStart != null) TouchpadTouchStart(this, e); }
protected virtual void EnablePointerBeam(object sender, ControllerInteractionEventArgs e) { TurnOnBeam(e.controllerIndex); }
private void DoUseOff(object sender, ControllerInteractionEventArgs e) { targetPointerRotation = originalPointerRotation; }
private void DoGrabOn(object sender, ControllerInteractionEventArgs e) { targetGripRotation = maxRotation; }
private void DoTouchpadAxisChanged(object sender, ControllerInteractionEventArgs e) { remoteBeamScript.SetTouchAxis(e.touchpadAxis); }
private void DoUseOn(object sender, ControllerInteractionEventArgs e) { targetPointerRotation = maxRotation; }
private void DoTouchpadTouchEnd(object sender, ControllerInteractionEventArgs e) { remoteBeamScript.SetTouchAxis(Vector2.zero); }
private void DoTouchpadAxisChanged(object sender, ControllerInteractionEventArgs e) { touchAxis = e.touchpadAxis; }
private void DoTouchpadTouchEnd(object sender, ControllerInteractionEventArgs e) { touchAxis = Vector2.zero; }
public virtual void OnGripReleased(ControllerInteractionEventArgs e) { if (GripReleased != null) GripReleased(this, e); }
private void DoGrabOff(object sender, ControllerInteractionEventArgs e) { targetGripRotation = originalGripRotation; }
public virtual void OnTouchpadReleased(ControllerInteractionEventArgs e) { if (TouchpadReleased != null) TouchpadReleased(this, e); }
private void DoTriggerPressed(object sender, ControllerInteractionEventArgs e) { tooltips.ShowTips(true, VRTK_ControllerTooltips.TooltipButtons.TriggerTooltip); actions.ToggleHighlightTrigger(true, Color.yellow, 0.5f); actions.SetControllerOpacity(0.8f); }
public virtual void OnTriggerReleased(ControllerInteractionEventArgs e) { if (TriggerReleased != null) TriggerReleased(this, e); }
protected virtual void SetPointerDestination(object sender, ControllerInteractionEventArgs e) { PointerSet(); }