private void Update() { int wandCount = ViveWand.wandCount; bool targeted = false; bool targetedAndActivated = false; for (int i = 0; i < wandCount; i++) { ViveWand wand = ViveWand.Wand(i); if (!wand) { continue; } if (wand.skin == ViveWand.ViveWandSkins.Beam) { continue; } if (wand.targetedGameObject == gameObject) { targeted = true; if (wand.IsInteractionPressed(XperAction.Grip) || wand.IsInteractionPressed(XperAction.Trigger)) { targetedAndActivated = true; } } } if (targeted) { if ((m_scaleFactor <= 1) || (m_scaleFactor >= m_maxScale)) { m_scaleFactorDirection = -m_scaleFactorDirection; } } else { m_scaleFactorDirection = -1; } m_scaleFactor += m_scaleFactorDirection * Time.deltaTime * m_scaleSpeed; m_scaleFactor = Mathf.Max(Mathf.Min(m_scaleFactor, m_maxScale), 1); transform.localScale = m_scaleFactor * m_baseScale; if (m_isUpperArrow) { StageManager.MoveStageUp(targetedAndActivated); } else { StageManager.MoveStageDown(targetedAndActivated); } }
private bool CheckWandAction(ViveWand wand, XperAction action, XperRange range) { return(wand.IsInteractionPressed(action) && XperManager.Allows(m_itemType, action, range)); }