public void OnButtonPressed(VirtualButtonBehaviour vb)
 {
     charX.SetActive(true);
     StableTree.SetActive(false);
     pressed = true;
     if (!xmasSource.isPlaying)
     {
         xmasSource.PlayOneShot(xmasClip);
     }
 }
Beispiel #2
0
    /// <summary>
    ///     Implementation of the ITrackableEventHandler function called when the
    ///     tracking state changes.
    /// </summary>
    public void OnTrackableStateChanged(
        TrackableBehaviour.Status previousStatus,
        TrackableBehaviour.Status newStatus)
    {
        m_PreviousStatus = previousStatus;
        m_NewStatus      = newStatus;

        Debug.Log("Trackable " + mTrackableBehaviour.TrackableName +
                  " " + mTrackableBehaviour.CurrentStatus +
                  " -- " + mTrackableBehaviour.CurrentStatusInfo);

        if (newStatus == TrackableBehaviour.Status.DETECTED ||
            newStatus == TrackableBehaviour.Status.TRACKED ||
            newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED)
        {
            OnTrackingFound();
            if (mTrackableBehaviour.TrackableName == "Xx")
            {
                Default.PlayOneShot(DefaultClip);
                StableTree.SetActive(true);
            }
        }
        else if (previousStatus == TrackableBehaviour.Status.TRACKED &&
                 newStatus == TrackableBehaviour.Status.NO_POSE)
        {
            OnTrackingLost();
            {
                if (mTrackableBehaviour.TrackableName == "Xx")
                {
                    Reset.SetActive(false);
                    Asource.Stop();
                    Default.Stop();
                }
            }
        }
        else
        {
            // For combo of previousStatus=UNKNOWN + newStatus=UNKNOWN|NOT_FOUND
            // Vuforia is starting, but tracking has not been lost or found yet
            // Call OnTrackingLost() to hide the augmentations
            OnTrackingLost();
        }
    }