Beispiel #1
0
        private void DrawMoveAnimation(UIMoveAnimation moveAnimation)
        {
            DrawAnimation(moveAnimation);
            EditorGUILayout.LabelField("Path");

            if (moveAnimation.Path == null)
            {
                moveAnimation.Path = new List <Vector2>();
            }

            for (int n = 0; n < moveAnimation.Path.Count; n++)
            {
                moveAnimation.Path[n] = EditorGUILayout.Vector2Field("P" + (n + 1), moveAnimation.Path[n]);

                if (GUILayout.Button("-"))
                {
                    moveAnimation.Path.RemoveAt(n);
                }
            }

            if (GUILayout.Button("+"))
            {
                moveAnimation.Path.Add(new Vector2());
            }
        }
Beispiel #2
0
        private void DrawMoveAnimation(UIMoveAnimation moveAnimation)
        {
            DrawAnimation(moveAnimation);

            EditorGUI.LabelField(new Rect(m_position.x, m_position.y += m_space.y, m_width, m_height), "Path", EditorStyles.boldLabel);

            if (moveAnimation.Path == null)
            {
                moveAnimation.Path = new List <Vector2>();
            }

            while (moveAnimation.Path.Count < 2)
            {
                moveAnimation.Path.Add(new Vector2());
            }

            m_position.x += 10.0f;

            for (int n = 0; n < moveAnimation.Path.Count; n++)
            {
                GUIContent cont = new GUIContent("P" + (n + 1), "Length of this animation in seconds");
                EditorGUI.LabelField(new Rect(m_position.x, m_position.y += m_space.y, m_width, m_height), cont, EditorStyles.boldLabel);
                moveAnimation.Path[n] = EditorGUI.Vector2Field(new Rect(m_position.x + 10.0f, m_position.y += m_space.y, m_width, m_height), "", moveAnimation.Path[n]);


                if (GUI.Button(new Rect(m_position.x + 10.0f + m_width + 5.0f, m_position.y, 15.0f, 15.0f), "-"))
                {
                    moveAnimation.Path.RemoveAt(n);
                }

                if (GUI.Button(new Rect(m_position.x + 10.0f + m_width + 5.0f + 18.0f, m_position.y, 18.0f, 15.0f), "+"))
                {
                    int newIndex = n + 1;

                    if (newIndex < moveAnimation.Path.Count)
                    {
                        moveAnimation.Path.Insert(n + 1, new Vector2());
                    }
                    else
                    {
                        moveAnimation.Path.Add(new Vector2());
                    }
                }
            }
        }