コード例 #1
0
    void GetHammerMovement()
    {
        var currentForce = Input.gyro.userAcceleration.x * forceMultiplier;

        var isMoving = currentForce > forceThreshold;

        if (isMoving)
        {
            totalForce += currentForce;
        }
        else if (!isMoving && totalForce > 0)
        {
            if (cooldownTime > currentTime)
            {
                return;
            }

            currentTime = 0f;
            CmdHammerSwing(totalForce);

            // TODO: Force exponential not linear
            Vibration.CreateOneShot(vibrationDuration, (int)totalForce);
            totalForce = 0f;
        }
    }
コード例 #2
0
    internal void Deselect()
    {
        // Vibrate
        Vibration.CreateOneShot(250, 15);

        SelectedObject = null;
    }
コード例 #3
0
        private void Shuffle()
        {
            float speed  = -1f;
            int   amount = -1;

            switch (m_Difficulty.value)
            {
            case 0:
                speed  = 0.5f;
                amount = 10;
                break;

            case 1:
                speed  = 0.25f;
                amount = 15;
                break;

            case 2:
                speed  = 0.15f;
                amount = 20;
                break;

            default:
                break;
            }

            if (m_ShuffleButton.enabled)
            {
                Vibration.CreateOneShot(100, 255);
                ToggleButtons("OFF");
                m_ResultText.enabled = false;
                Wager.Instance.resetCurrentPosition();
                StartCoroutine(ShuffleCups(amount, speed));
            }
        }
コード例 #4
0
 private void ShowBallPosition()
 {
     if (m_ShowBallButton.enabled)
     {
         Vibration.CreateOneShot(100, 255);
         ToggleButtons("OFF");
         StartCoroutine(RevealBall());
     }
 }
コード例 #5
0
 private void Scan()
 {
     if (m_ScanButton.enabled)
     {
         Vibration.CreateOneShot(500, 10);
         ToggleButtons("OFF");
         StartCoroutine(StartLocating());
     }
 }
コード例 #6
0
    private void ChosenAnswer(int a)
    {
        bool didLose = false;

        if (a == -1)
        {
            for (int i = 1; i <= 4; i++)
            {
                GetButtonImage(i).color = Color.red;
            }
            didLose = true;
            FindObjectOfType <MusicManager>().Play("Incorrect");
        }
        else if (Int32.Parse(currentQuestion.Answer) != a)
        {
            GetButtonImage(a).color = Color.red;
            Vibration.CreateOneShot(200);
            Debug.Log("Incorrect!! Correct choice is " + Int32.Parse(currentQuestion.Answer) + " you chose " + a);
            didLose = true;
            FindObjectOfType <MusicManager>().Play("Incorrect");
            //Debug.Log("vibrate");
        }
        GetButtonImage(Int32.Parse(currentQuestion.Answer)).color = Color.green;
        if (Int32.Parse(currentQuestion.Answer) == a)
        {
            numCorrect++;
            Debug.Log("Correct!!");
            FindObjectOfType <MusicManager>().Play("Correct");
        }

        choice1Text.GetComponentInParent <Button>().enabled = false;
        choice2Text.GetComponentInParent <Button>().enabled = false;
        choice3Text.GetComponentInParent <Button>().enabled = false;
        choice4Text.GetComponentInParent <Button>().enabled = false;

        StartCoroutine(ExecuteAfterTime(2, didLose));
    }
コード例 #7
0
ファイル: onTouch.cs プロジェクト: inzywong/HapticHero
 private void PlayString(string name)
 {
     Vibration.CreateOneShot(stringVib[name]);
 }
コード例 #8
0
 void _Vibrate()
 {
     Vibration.CreateOneShot(5, 30);
 }
コード例 #9
0
 public void PlayFeedback()
 {
     soundCtrl.PlayClip();
     Vibration.CreateOneShot((long)2f, 5);
 }