private void UpdateBhapticsState() { float currentTime = Time.time; bool isReloading = (m_nextReloadHapticPatternTime > 0); if (isReloading && currentTime >= m_nextReloadHapticPatternTime) { if (Controllers.mainControllerType == HandType.Left) { m_hapticPlayer.SubmitRegistered(VEST_RELOAD_L_KEY); m_hapticPlayer.SubmitRegistered(ARMS_RELOAD_L_KEY); } else { m_hapticPlayer.SubmitRegistered(VEST_RELOAD_R_KEY); m_hapticPlayer.SubmitRegistered(ARMS_RELOAD_R_KEY); } m_nextReloadHapticPatternTime += RELOAD_FEEDBACK_DURATION; } if (m_nextHeartbeatPatternTime > 0f && currentTime >= m_nextHeartbeatPatternTime) { m_hapticPlayer.SubmitRegistered(VEST_NEED_HEALTH_KEY); m_nextHeartbeatPatternTime += HEARTBEAT_REPEAT_DELAY; } if (m_nextBodyscanPatternTime > 0f && currentTime >= m_nextBodyscanPatternTime) { m_hapticPlayer.SubmitRegistered(VEST_BODY_SCAN_KEY); m_nextBodyscanPatternTime += BODY_SCAN_REPEAT_DELAY; } if (m_lastFlashlightEnabledState != m_player.Inventory.FlashlightEnabled) { FlashlightToggledHaptics(); m_lastFlashlightEnabledState = m_player.Inventory.FlashlightEnabled; } bool isCrouchedPhysically = IsCrouchedPhysically(); if (m_lastIsCrouchedPhysically != isCrouchedPhysically) { CrouchToggleHaptics(isCrouchedPhysically); m_lastIsCrouchedPhysically = isCrouchedPhysically; } if (m_bioscanStopFramesCount > 0 && ++m_bioscanStopFramesCount >= 5) { m_nextBodyscanPatternTime = 0f; m_hapticPlayer.TurnOff(VEST_BODY_SCAN_KEY); m_bioscanStopFramesCount = 0; } }
public void StopHapticFeedback(FeedbackType effect) { if (hapticPlayer != null) { if (feedbackMap.ContainsKey(effect)) { if (feedbackMap[effect].feedbackFileCount > 0) { for (int i = 1; i <= feedbackMap[effect].feedbackFileCount; i++) { string key = feedbackMap[effect].prefix + i.ToString(); hapticPlayer.TurnOff(key); } } } } }