private void Update() { if (spinning && held) { if (Time.time >= vibrationTimer) { var source = playerHand; playerController.Vibration(0, 0.2f, 0.2f, 0.7f, source); vibrationTimer = Time.time + 0.2f; } else { playerController.Vibration(0, 0, 0, 0, playerHand); } } }
public override void OnControllerEnter(PlayerViveController currentController) { base.OnControllerEnter(currentController); if (m_Toggled == false) { m_Toggled = true; if (currentController != null) { var source = currentController.GetCurrentHand(); currentController.Vibration(0, 0.7f, 10, 1, source); } GetComponent <AudioPlayer>().Play(); GetComponent <Renderer>().material.SetColor("_Color", Color.green); m_Train.GetComponent <TrainArriver>().BeginArrival(() => { transform.Find("AnnouncementBeep").GetComponent <AudioPlayer>().Play(); }); transform.DOLocalMoveX(m_ToggleOffset, 0.2f).SetRelative(); } }
public override void OnControllerEnter(PlayerViveController currentController) { base.OnControllerEnter(currentController); if (bIsBroken) { return; } if (ActivateCount >= BreakAtCount) { ownedLights.bIsOn = true; ownedLights.ToggleLights(); bIsBroken = true; bSwitchIsOn = false; var rigidbody = transform.GetComponent <Rigidbody>(); rigidbody.useGravity = true; rigidbody.isKinematic = false; rigidbody.collisionDetectionMode = CollisionDetectionMode.Continuous; bCount = true; return; } Audio.Play(); var source = currentController.GetCurrentHand(); currentController.Vibration(0, 0.2f, 5, 1, source); if (bSwitchIsOn) { bSwitchIsOn = false; transform.localRotation = Quaternion.Euler(0, 0, -90); ownedLights.ToggleLights(); } else { bSwitchIsOn = true; ActivateCount += 1; transform.localRotation = Quaternion.Euler(0, 0, 0); ownedLights.ToggleLights(); } }