private void OnFadeInCompleted()
 {
     fadeRate          = 0.0f;
     state             = RingCommandState.ACTIVE;
     handMoveLeftRight = 0.0f;
     lastHandPos       = Vector3.zero;
 }
 private void OnFadeOutCompleted()
 {
     // フェードアウトが完了したので、ステートを更新して、リングコマンドのアイテムを非活性化する
     fadeRate = 1.0f;
     state    = RingCommandState.INACTIVE;
     for (int i = 0; i < commandIcons.Length; i++)
     {
         commandIcons[i].SetActive(false);
     }
 }
 private void StartFadeOut()
 {
     // フェードアウト処理を開始する
     // ステータスを更新するのみで、アニメーション系のパラメータの更新はUpdateで行う
     if (fadeOutSound != null)
     {
         AudioSource.PlayClipAtPoint(fadeOutSound, this.transform.position);
     }
     state = RingCommandState.ANIMATING_FADE_OUT;
 }
 private void OnEnable()
 {
     state    = RingCommandState.INACTIVE;
     fadeRate = 1.0f;
     InteractionManager.InteractionSourceDetected += InteractionManager_InteractionSourceDetected;
     InteractionManager.InteractionSourceLost     += InteractionManager_InteractionSourceLost;
     InteractionManager.InteractionSourcePressed  += InteractionManager_InteractionSourcePressed;
     InteractionManager.InteractionSourceReleased += InteractionManager_InteractionSourceReleased;
     InteractionManager.InteractionSourceUpdated  += InteractionManager_InteractionSourceUpdated;
 }
 private void OnRotationComplete()
 {
     // 回転処理完了時に選択状態を更新
     SelectIcon(this.nextSelect);
     if (state == RingCommandState.ANIMATING_ROTATE)
     {
         // ステートを更新して、アニメーション用のrotateRateをリセットする。
         state      = RingCommandState.ACTIVE;
         rotateRate = 0.0f;
     }
 }
    private void StartRotation(int direction)
    {
        // 回転処理を開始する
        // ステートを更新して、回転アニメーション関連のパラメータを初期設定する
        state           = RingCommandState.ANIMATING_ROTATE;
        rotateRate      = 0.0f;
        this.nextSelect = (this.selectedCommand + direction + this.commandIcons.Length) % this.commandIcons.Length;

        if (rotateSound != null)
        {
            AudioSource.PlayClipAtPoint(rotateSound, this.transform.position);
        }
    }
 private void StartFadeIn()
 {
     // フェードアウト処理を開始する
     // ステータスを更新し、アニメーション系のパラメータを初期化する
     // アニメーション系のパラメータの更新はUpdateで行う
     state = RingCommandState.ANIMATING_FADE_IN;
     for (int i = 0; i < commandIcons.Length; i++)
     {
         commandIcons[i].SetActive(true);
     }
     // リングコマンドの表示位置をフェードイン開始時のカメラの1.5m先に設定する。
     // カメラに追従するのもうざいかもなので、ワールドロック的にしておく。
     this.transform.position = Camera.main.transform.position + Camera.main.transform.forward * 1.5f;
     this.transform.LookAt(Camera.main.transform.position + Camera.main.transform.forward * 2.0f, Vector3.up);
     if (fadeInSound != null)
     {
         AudioSource.PlayClipAtPoint(fadeInSound, this.transform.position);
     }
 }