Пример #1
0
        private void OnEnable()
        {
            //Check for target
            if (target == null)
            {
                return;
            }

            //Get the control id
            m_editor_control_id = GUIUtility.GetControlID(this.GetHashCode(), FocusType.Passive);

            //Get our manager
            m_manager = (PegasusManager)target;

            //Set up the default camera if we can
            if (m_manager.m_target == null)
            {
                if (Camera.main != null)
                {
                    m_manager.m_target = Camera.main.gameObject;
                    if (m_manager.m_target == null)
                    {
                        m_manager.name = "Pegasus Manager";
                    }
                    else
                    {
                        m_manager.name = "Pegasus Manager - " + m_manager.m_target.name;
                    }
                    EditorUtility.SetDirty(m_manager);
                }
            }

            //Set up any segments / Update segments for the manager
            if (!Application.isPlaying)
            {
                m_manager.InitialiseFlythrough();
            }

            //And select nothing
            m_manager.SelectPoi(null);

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