Example #1
0
        public static void Init(UIAnimator animator)
        {
            // Get existing open window or if none, make a new one:
            W_UIAnimator window = (W_UIAnimator)EditorWindow.GetWindow(typeof(W_UIAnimator), false, "Animator Editor");

            window.minSize = new Vector2(420, 300);
        }
Example #2
0
        public override void Construct(UIAnimator animator)
        {
            base.Construct(animator);

            //process the path
            m_processedPath = ProcessPath(m_path);

            //first get path distance
            m_pathDistance      = new List <float>();
            m_totalPathDistance = 0.0f;

            for (int n = 0; n < m_processedPath.Count - 1; n++)
            {
                float d = Vector2.Distance(m_processedPath[n], m_processedPath[n + 1]);

                m_pathDistance.Add(d);
                m_totalPathDistance += d;
            }

            m_pathTime = new List <float>();

            for (int n = 0; n < m_processedPath.Count - 1; n++)
            {
                m_pathTime.Add((m_pathDistance[n] / m_totalPathDistance) * m_length);
                Debug.Log(m_pathTime[n]);
            }
        }
Example #3
0
        private void OnGUI()
        {
            if (m_animator == null)
            {
                m_animator = Selection.activeGameObject.GetComponent <UIAnimator>();

                if (m_animator == null)
                {
                    return;
                }
            }

            m_position = new Vector2(20.0f, 55.0f);
            m_space    = new Vector2(95.0f, 20.0f);

            float desireX = 0.0F;

            for (int n = 0; n < m_animator.AnimationList.Count; n++)
            {
                desireX = m_position.x;

                DrawUIAnimation(m_animator.AnimationList[n]);

                float newSliderValue = EditorGUI.Slider(new Rect(desireX, m_position.y += m_space.y += 5.0f, m_width * 2.0f, m_height), m_sliderValue, 0.0f, 1.0f);

                if (newSliderValue != m_sliderValue)
                {
                    m_animator.Construct();

                    m_sliderValue = newSliderValue;
                    m_animator.AnimationList[n].EvaluateAtTime(newSliderValue);
                }

                if (GUI.Button(new Rect(desireX, m_position.y += m_space.y += 5.0f, m_width, m_height), "Play"))
                {
                    m_animator.Construct();

                    m_animator.AnimationList[n].Play();
                }
            }


            /*
             * if (GUI.Button(new Rect(m_position.x, m_position.y += m_space.y += 5.0f, 20.0f, 20.0f), "+"))
             * {
             *  m_animator.AnimationList.Add(new UIAnimation());
             * }
             */
        }
Example #4
0
 public virtual void Construct(UIAnimator animator)
 {
     m_animator = animator;
     m_rect     = m_animator.GetComponent <RectTransform>();
 }