using System; using System.Collections; using System.Collections.Generic; using UnityEngine.InputSystem; using UnityEngine.UI; using UnityEngine.XR.Interaction.Toolkit.Samples.StarterAssets; using TMPro; using LazyFollow = UnityEngine.XR.Interaction.Toolkit.UI.LazyFollow; namespace UnityEngine.XR.Templates.MR { public struct Goal { public GoalManager.OnboardingGoals CurrentGoal; public bool Completed; public Goal(GoalManager.OnboardingGoals goal) { CurrentGoal = goal; Completed = false; } } public class GoalManager : MonoBehaviour { public enum OnboardingGoals { Empty, FindSurfaces, TapSurface, } Queue m_OnboardingGoals; Goal m_CurrentGoal; bool m_AllGoalsFinished; int m_SurfacesTapped; int m_CurrentGoalIndex = 0; [Serializable] class Step { [SerializeField] public GameObject stepObject; [SerializeField] public string buttonText; public bool includeSkipButton; } [SerializeField] List m_StepList = new List(); [SerializeField] public TextMeshProUGUI m_StepButtonTextField; [SerializeField] public GameObject m_SkipButton; [SerializeField] GameObject m_LearnButton; [SerializeField] GameObject m_LearnModal; [SerializeField] Button m_LearnModalButton; [SerializeField] GameObject m_CoachingUIParent; [SerializeField] FadeMaterial m_FadeMaterial; [SerializeField] Toggle m_PassthroughToggle; [SerializeField] LazyFollow m_GoalPanelLazyFollow; [SerializeField] GameObject m_TapTooltip; [SerializeField] GameObject m_VideoPlayer; [SerializeField] Toggle m_VideoPlayerToggle; [SerializeField] ARFeatureController m_FeatureController; [SerializeField] ObjectSpawner m_ObjectSpawner; const int k_NumberOfSurfacesTappedToCompleteGoal = 1; Vector3 m_TargetOffset = new Vector3(-.5f, -.25f, 1.5f); void Start() { m_OnboardingGoals = new Queue(); var welcomeGoal = new Goal(OnboardingGoals.Empty); var findSurfaceGoal = new Goal(OnboardingGoals.FindSurfaces); var tapSurfaceGoal = new Goal(OnboardingGoals.TapSurface); var endGoal = new Goal(OnboardingGoals.Empty); m_OnboardingGoals.Enqueue(welcomeGoal); m_OnboardingGoals.Enqueue(findSurfaceGoal); m_OnboardingGoals.Enqueue(tapSurfaceGoal); m_OnboardingGoals.Enqueue(endGoal); m_CurrentGoal = m_OnboardingGoals.Dequeue(); if (m_TapTooltip != null) m_TapTooltip.SetActive(false); if (m_VideoPlayer != null) { m_VideoPlayer.SetActive(false); if (m_VideoPlayerToggle != null) m_VideoPlayerToggle.isOn = false; } if (m_FadeMaterial != null) { m_FadeMaterial.FadeSkybox(false); if (m_PassthroughToggle != null) m_PassthroughToggle.isOn = false; } if (m_LearnButton != null) { m_LearnButton.GetComponent