예제 #1
0
        void Start()
        {
            //Grab main camera if necessary
            if (m_mainCamera == null)
            {
                m_mainCamera = Camera.main;
            }

            //Create new path if necessary
            if (m_path == null)
            {
                m_path = PegasusPath.CreatePegasusPath();
            }

            //Show reticule
            if (m_reticuleGO == null)
            {
                m_reticuleGO = GameObject.Find("Pegasus Capture Reticule");
            }
            if (m_reticuleGO != null)
            {
                m_reticuleGO.SetActive(m_showReticule && m_enableOnStart);
                UpdateReticuleText();
            }

            //Show previous path
            if (m_enableOnStart)
            {
                //Clear path
                if (m_clearOnStart)
                {
                    m_path.ClearPath();
                }

                //Display path
                foreach (var path in m_path.m_path)
                {
                    GameObject marker = GameObject.CreatePrimitive(PrimitiveType.Sphere);
                    marker.transform.position   = path.m_location;
                    marker.transform.localScale = Vector3.one * 0.25f;
                }
            }
        }
예제 #2
0
        private void OnEnable()
        {
            //Check for target
            if (target == null)
            {
                return;
            }

            //Get our manager
            m_capture = (PegasusCapture)target;

            //Set up the default camera if we can
            if (m_capture.m_mainCamera == null)
            {
                if (Camera.main != null)
                {
                    m_capture.m_mainCamera = Camera.main;
                    EditorUtility.SetDirty(m_capture);
                }
            }

            //Set up the capturer object
            if (!Application.isPlaying)
            {
                if (m_capture.m_path == null)
                {
                    m_capture.m_path = PegasusPath.CreatePegasusPath();
                }

                //And add Pegasus to the environment
                SetPegasusDefines();

                //Update the reticules text if we have it
                m_capture.UpdateReticuleText();

                //And visibility
                m_capture.UpdateReticuleVisibility();
            }
        }