public void PrepareData(TextFxAnimationManager anim_manager, LetterSetup[] letters, ANIMATION_DATA_TYPE what_to_update, int num_words, int num_lines, AnimatePerOptions animate_per)
        {
            if (letters == null || letters.Length == 0)
            {
                return;
            }

            if (m_letters_to_animate == null || what_to_update == ANIMATION_DATA_TYPE.ALL || what_to_update == ANIMATION_DATA_TYPE.ANIMATE_ON)
            {
                CalculateLettersToAnimate(letters);
            }

            if (what_to_update == ANIMATION_DATA_TYPE.ALL || what_to_update == ANIMATION_DATA_TYPE.COLOUR || m_defaultTextColourProgression == null)
            {
                // Set values for default text colour progression
                VertexColour[] defaultextColours = new VertexColour[m_letters_to_animate.Count];

                for (int idx = 0; idx < m_letters_to_animate.Count; idx++)
                {
                    defaultextColours[idx] = letters[m_letters_to_animate[idx]].BaseColour;
                }

                m_defaultTextColourProgression.SetValues(defaultextColours);

                // Mark as the default colour progression
                m_defaultTextColourProgression.SetReferenceData(-1, ANIMATION_DATA_TYPE.COLOUR, true);
            }


            // Prepare progression data in all actions
            LetterAction letter_action;
            LetterAction prev_action           = null;
            bool         prev_action_end_state = true;

            for (int action_idx = 0; action_idx < m_letter_actions.Count; action_idx++)
            {
                letter_action = m_letter_actions[action_idx];

                letter_action.PrepareData(anim_manager, ref letters, this, action_idx, what_to_update, m_letters_to_animate.Count, m_num_white_space_chars_to_include, num_words, num_lines, prev_action, animate_per, m_defaultTextColourProgression, prev_action_end_state);

                if (letter_action.m_action_type == ACTION_TYPE.ANIM_SEQUENCE)
                {
                    // Set default previous action settings
                    prev_action_end_state = true;
                    prev_action           = letter_action;
                }

                // Check for reverse loops, and how the animation should progress from there
                foreach (ActionLoopCycle loop_cycle in m_loop_cycles)
                {
                    if (loop_cycle.m_end_action_idx == action_idx && loop_cycle.m_loop_type == LOOP_TYPE.LOOP_REVERSE && !loop_cycle.m_finish_at_end)
                    {
                        prev_action           = m_letter_actions[loop_cycle.m_start_action_idx];
                        prev_action_end_state = false;
                    }
                }
            }
        }
Пример #2
0
        public void RefreshDefaultTextColour(LetterSetup[] letters)
        {
            CalculateLettersToAnimate(letters);

            // Set values for default text colour progression
            VertexColour[] defaultextColours = new VertexColour[m_letters_to_animate.Count];

            for (int idx = 0; idx < m_letters_to_animate.Count; idx++)
            {
                int letterIdx = m_letters_to_animate [idx];

                if (letterIdx >= letters.Length)
                {
                    break;
                }

                defaultextColours [idx] = letters[letterIdx].BaseColour;
            }

            m_defaultTextColourProgression.SetValues(defaultextColours);

            // Mark as the default colour progression
            m_defaultTextColourProgression.SetReferenceData(-1, ANIMATION_DATA_TYPE.COLOUR, true);
        }