Esempio n. 1
0
        /// <summary>
        /// Draw the transition lines.
        /// </summary>
        public virtual void DrawTransitionArrows()
        {
            // Is there a valid styles object?
            if (s_Styles == null)
            {
                s_Styles = new StateGUI.Styles();
            }

            // The state is not null?
            if (m_State != null)
            {
                // Get position
                Rect position = this.rect;
                // Draw the transitions arrows
                for (int i = 0; i < m_TransitionGUIs.Count; i++)
                {
                    m_TransitionGUIs[i].DrawDestinationArrow(position);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Draw the state as a GUI.Window.
        /// </summary>
        public void OnGUIWindow()
        {
            // Is there a valid styles object?
            if (s_Styles == null)
            {
                s_Styles = new StateGUI.Styles();
            }

            if (m_State != null)
            {
                // Is there a valid window style?
                if (m_WindowStyle == null || m_WindowStyleOn == null || m_State.color != m_StateColor)
                {
                    SetWindowColor(m_State.color);
                }
                SetSearchColor();

                var guiColor = GUI.color;   // cache gui color

                // This is the enabled state?
                // Animate window alpha
                // if (Application.isPlaying && m_State.enabled && Event.current.type == EventType.Repaint)
                //     GUI.color = Color.Lerp(s_Styles.activeColor, guiColor, Mathf.PingPong(Time.time, 1f));

                // Draw state window
                rect = GUI.Window(m_Id, rect, this.StateGUIWindow, GUIContent.none, Selection.Contains(m_State) ? m_WindowStyleOn : m_WindowStyle);

                // Restore gui color
                GUI.color = guiColor;
            }
            else
            {
                this.Refresh(); // Used as a workaround the missing callback in the apply button prefab.
            }
            // Transition connections
            if (Event.current.type == EventType.MouseDrag && TransitionDragAndDrop.candidateForDrag != null && m_TransitionGUIs.Contains(TransitionDragAndDrop.candidateForDrag) && !rect.Contains(Event.current.mousePosition))
            {
                TransitionDragAndDrop.StartDrag();
            }
        }