Ejemplo n.º 1
0
    public void OnTrackableStateChanged(
        TrackableBehaviour.Status previousStatus,
        TrackableBehaviour.Status newStatus)
    {
        m_PreviousStatus = previousStatus;
        m_NewStatus      = newStatus;

        if (newStatus == TrackableBehaviour.Status.DETECTED ||
            newStatus == TrackableBehaviour.Status.TRACKED)
        {
            Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " found");
            IsTracking = true;
            scanner.SetActive(false);
            if (!m_SceneController.gameReset)
            {
                OnTrackingFound();
            }
            if (m_SceneController.sceneName == "Tutorial")
            {
                if (mTrackableBehaviour.TrackableName == "AR3_BW" && m_InsManager.ins.Length == 6)
                {
                    m_InsManager.Next();
                }
            }
        }
        else if (newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED)
        {
            Debug.Log("Extended tracking is on");
            IsExtendedTracking = true;
            OnTrackingFound();
        }
        else if (previousStatus == TrackableBehaviour.Status.TRACKED &&
                 newStatus == TrackableBehaviour.Status.NO_POSE)
        {
            Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " lost");
            OnTrackingLost();
            m_InsManager.allowTap = false;
            if (scanner == null)
            {
                scanner.SetActive(true);
            }
        }
        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
            IsExtendedTracking = false;
            OnTrackingLost();
        }
    }