Exemplo n.º 1
0
        private void Start()
        {
            m_NavigationManager = FindObjectOfType <NavigationManager>();
            m_NavigationGraph   = m_NavigationManager.GetComponent <NavigationGraph>();
            m_MeshRenderer      = gameObject.GetComponent <MeshRenderer>();

            position = transform.position;
            nodeName = gameObject.name;

            if (m_NavigationGraph != null)
            {
                m_NavigationGraph.AddNode(this);
            }
        }
        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_navigationGraph = GetComponent <NavigationGraph>();
            if (m_navigationGraph == null)
            {
                Debug.LogWarning("NavigationManager: Missing Navigation Graph 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;
        }