Exemple #1
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     if (instance != this)
     {
         Debug.LogError("There must be only one NavigationGraphManager in a scene.");
         UnityEngine.Object.DestroyImmediate(this);
         return;
     }
 }
Exemple #2
0
        private void InitializeNavigationManager()
        {
            if (m_arSpace == null)
            {
                m_arSpace = FindObjectOfType <ARSpace>();

                if (m_arSpace == null)
                {
                    Debug.LogWarning("NavigationManager: No AR Space found in scene, ensure one exists.");
                    return;
                }
            }

            m_NavigationGraphManager = GetComponent <NavigationGraphManager>();
            if (m_NavigationGraphManager == null)
            {
                Debug.LogWarning("NavigationManager: Missing Navigation Graph Manager component.");
                return;
            }

            m_playerTransform = Camera.main.transform;
            if (m_playerTransform == null)
            {
                Debug.LogWarning("NavigationManager: Could not find the main camera. Do you have the MainCamera tag applied?");
                return;
            }

            if (m_navigationPathPrefab == null)
            {
                Debug.LogWarning("NavigationManager: Missing navigation path object reference.");
                return;
            }

            if (m_navigationPathPrefab != null)
            {
                if (m_navigationPathObject == null)
                {
                    m_navigationPathObject = Instantiate(m_navigationPathPrefab);
                    m_navigationPathObject.SetActive(false);
                    m_navigationPath = m_navigationPathObject.GetComponent <NavigationPath>();
                }

                if (m_navigationPath == null)
                {
                    Debug.LogWarning("NavigationManager: NavigationPath component in Navigation path is missing.");
                    return;
                }
            }

            if (m_TargetsList == null)
            {
                Debug.LogWarning("NavigationManager: Navigation Targets List reference is missing.");
                return;
            }

            if (m_ShowListIcon == null)
            {
                Debug.LogWarning("NavigationManager: \"Show List\" icon is missing.");
                return;
            }

            if (m_SelectTargetIcon == null)
            {
                Debug.LogWarning("NavigationManager: \"Select Target\" icon is missing.");
                return;
            }

            if (m_TargetsListIcon == null)
            {
                Debug.LogWarning("NavigationManager: \"Targets List\" icon reference is missing.");
                return;
            }

            if (m_TargetsListText == null)
            {
                Debug.LogWarning("NavigationManager: \"Targets List\" text reference is missing.");
                return;
            }

            if (m_StopNavigationButton == null)
            {
                Debug.LogWarning("NavigationManager: Stop Navigation Button reference is missing.");
                return;
            }

            m_managerInitialized = true;
        }