示例#1
0
    /// <summary>
    ///     Implementation of the ITrackableEventHandler function called when the
    ///     tracking state changes.
    /// </summary>
    public void OnTrackableStateChanged(
        TrackableBehaviour.Status previousStatus,
        TrackableBehaviour.Status newStatus)
    {
        if (newStatus == TrackableBehaviour.Status.DETECTED ||
            newStatus == TrackableBehaviour.Status.TRACKED ||
            newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED)
        {
            lightIsActive = true;
            player.SetActive(true);
            if (firstTime)
            {
                Initialize();
            }
        }
        else
        {
            lightIsActive = false;
            player.SetActive(false);
        }

        light.Change(lightIsActive);
    }