Example #1
0
    // Update is called once per frame
    void Update()
    {
        // Find the myo
        ThalmicMyo thalmicMyo = myo.GetComponent <ThalmicMyo>();


        // If the new pose is not the same as the last pose
        if (thalmicMyo.pose != _lastPose)
        {
            _lastPose = thalmicMyo.pose;

            // If the pose is wave in
            if (thalmicMyo.pose == Pose.WaveIn)
            {
                // Move the car to the left
                myRigidBody.position = new Vector2(myRigidBody.position.x - 10, myRigidBody.position.y);

                // If the car goes off screen
                if (myRigidBody.position.x < -12.6)
                {
                    // End the game
                    gameOver.gameObject.SetActive(true);
                    Destroy(myRigidBody);
                }
                // Call the method so myo does not lock
                ExtendUnlockAndNotifyUserAction(thalmicMyo);
            }

            // If the pose is wave out
            else if (thalmicMyo.pose == Pose.WaveOut)
            {
                // Move the car to the right
                myRigidBody.position = new Vector2(myRigidBody.position.x + 10, myRigidBody.position.y);

                // If the car goes off the screen
                if (myRigidBody.position.x > 12.47)
                {
                    // End the game
                    gameOver.gameObject.SetActive(true);
                    Destroy(myRigidBody);
                }
            }
            // Call the method so myo does not lock
            ExtendUnlockAndNotifyUserAction(thalmicMyo);
        }
    }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        myo.Unlock (UnlockType.Hold);

        if (myo.pose != _lastPose) {

            if (myo.pose == Pose.Fist && Time.time - lastTime > timethreshold) {
                lastTime = Time.time;
                _lastPose = myo.pose;

                UnityEngine.Vector3 point = findCollisionPosition();
                if (point != UnityEngine.Vector3.zero)
                {
                    tapHandler.handleTap(point.x, point.y);
                }
            }
        }
    }
Example #3
0
    // Update is called once per frame
    void Update()
    {
        myo.Unlock(UnlockType.Hold);


        if (myo.pose != _lastPose)
        {
            if (myo.pose == Pose.Fist && Time.time - lastTime > timethreshold)
            {
                lastTime  = Time.time;
                _lastPose = myo.pose;

                UnityEngine.Vector3 point = findCollisionPosition();
                if (point != UnityEngine.Vector3.zero)
                {
                    tapHandler.handleTap(point.x, point.y);
                }
            }
        }
    }