public void PrepareData(ref LetterSetup[] letters, int num_letters, int num_words, int num_lines, LetterAction prev_action, AnimatePerOptions animate_per, bool prev_action_end_state = true) { m_duration_progression.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_duration_progression.AnimatePer, m_duration_progression.OverrideAnimatePerOption)); if (m_audio_effects != null) { foreach (AudioEffectSetup effect_setup in m_audio_effects) { effect_setup.m_delay.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, effect_setup.m_delay.AnimatePer, effect_setup.m_delay.OverrideAnimatePerOption)); effect_setup.m_offset_time.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, effect_setup.m_offset_time.AnimatePer, effect_setup.m_offset_time.OverrideAnimatePerOption)); effect_setup.m_volume.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, effect_setup.m_volume.AnimatePer, effect_setup.m_volume.OverrideAnimatePerOption)); effect_setup.m_pitch.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, effect_setup.m_pitch.AnimatePer, effect_setup.m_pitch.OverrideAnimatePerOption)); } } if (m_particle_effects != null) { foreach (ParticleEffectSetup effect_setup in m_particle_effects) { effect_setup.m_position_offset.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, effect_setup.m_position_offset.AnimatePer, effect_setup.m_position_offset.OverrideAnimatePerOption), null); effect_setup.m_rotation_offset.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, effect_setup.m_rotation_offset.AnimatePer, effect_setup.m_rotation_offset.OverrideAnimatePerOption), null); effect_setup.m_delay.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, effect_setup.m_delay.AnimatePer, effect_setup.m_delay.OverrideAnimatePerOption)); effect_setup.m_duration.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, effect_setup.m_duration.AnimatePer, effect_setup.m_duration.OverrideAnimatePerOption)); } } if (m_action_type == ACTION_TYPE.BREAK) { return; } m_delay_progression.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_delay_progression.AnimatePer, m_delay_progression.OverrideAnimatePerOption)); if (m_offset_from_last && prev_action != null) { m_use_gradient_start = prev_action.m_use_gradient_end; if (prev_action_end_state) { if (m_use_gradient_start) { m_start_vertex_colour.Values = prev_action.m_end_vertex_colour.Values; } else { m_start_colour.Values = prev_action.m_end_colour.Values; } } else { if (m_use_gradient_start) { m_start_vertex_colour.Values = prev_action.m_start_vertex_colour.Values; } else { m_start_colour.Values = prev_action.m_start_colour.Values; } } } else { if (m_use_gradient_start || (prev_action != null && (prev_action.m_use_gradient_end))) { if (!m_use_gradient_start) { // Need to convert flat colour into a vertex colour m_use_gradient_start = true; m_start_vertex_colour.ConvertFromFlatColourProg(m_start_colour); } // add this colour to previous state m_start_vertex_colour.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_start_vertex_colour.AnimatePer, m_start_vertex_colour.OverrideAnimatePerOption), prev_action != null && (prev_action.m_use_gradient_end) ? prev_action.m_end_vertex_colour.Values : null, prev_action != null && (!prev_action.m_use_gradient_end) ? prev_action.m_end_colour.Values : null); } else { m_start_colour.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_start_colour.AnimatePer, m_start_colour.OverrideAnimatePerOption), prev_action != null ? prev_action.m_end_colour.Values : null); } } if (m_use_gradient_end || m_use_gradient_start) { if (!m_use_gradient_end) { // Need to convert flat colour into a vertex colour m_use_gradient_end = true; m_end_vertex_colour.ConvertFromFlatColourProg(m_end_colour); } m_end_vertex_colour.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_end_vertex_colour.AnimatePer, m_end_vertex_colour.OverrideAnimatePerOption), (m_use_gradient_start) ? m_start_vertex_colour.Values : null, (!m_use_gradient_start) ? m_start_colour.Values : null); } else { m_end_colour.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_end_colour.AnimatePer, m_end_colour.OverrideAnimatePerOption), m_start_colour.Values); } if (m_offset_from_last && prev_action != null) { m_start_pos.Values = prev_action_end_state ? prev_action.m_end_pos.Values : prev_action.m_start_pos.Values; m_start_euler_rotation.Values = prev_action_end_state ? prev_action.m_end_euler_rotation.Values : prev_action.m_start_euler_rotation.Values; m_start_scale.Values = prev_action_end_state ? prev_action.m_end_scale.Values : prev_action.m_start_scale.Values; } else { float[] start_pos_curve_letter_progressions = null; if (m_start_pos.Progression == ActionPositionVector3Progression.CURVE_OPTION_INDEX) { // Pre calculate letter progression values based on letter spacing start_pos_curve_letter_progressions = m_start_pos.BezierCurve.GetLetterProgressions(ref letters, m_letter_anchor_start); } m_start_pos.CalculatePositionProgressions(ref start_pos_curve_letter_progressions, GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_start_pos.AnimatePer, m_start_pos.OverrideAnimatePerOption), prev_action != null ? prev_action.m_end_pos.Values : new Vector3[] { Vector3.zero }); m_start_euler_rotation.CalculateRotationProgressions(ref start_pos_curve_letter_progressions, GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_start_euler_rotation.AnimatePer, m_start_euler_rotation.OverrideAnimatePerOption), prev_action != null ? prev_action.m_end_euler_rotation.Values : new Vector3[] { Vector3.zero }, m_start_pos.Progression == ActionPositionVector3Progression.CURVE_OPTION_INDEX ? m_start_pos.BezierCurve : null); m_start_scale.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_start_scale.AnimatePer, m_start_scale.OverrideAnimatePerOption), prev_action != null ? prev_action.m_end_scale.Values : new Vector3[] { Vector3.zero }); } float[] end_pos_curve_letter_progressions = null; if (m_end_pos.Progression == ActionPositionVector3Progression.CURVE_OPTION_INDEX) { // Pre calculate letter progression values based on letter spacing end_pos_curve_letter_progressions = m_end_pos.BezierCurve.GetLetterProgressions(ref letters, m_letter_anchor_end); } m_end_pos.CalculatePositionProgressions(ref end_pos_curve_letter_progressions, GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_end_pos.AnimatePer, m_end_pos.OverrideAnimatePerOption), m_start_pos.Values); m_end_euler_rotation.CalculateRotationProgressions(ref end_pos_curve_letter_progressions, GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_end_euler_rotation.AnimatePer, m_end_euler_rotation.OverrideAnimatePerOption), m_start_euler_rotation.Values, m_end_pos.Progression == ActionPositionVector3Progression.CURVE_OPTION_INDEX ? m_end_pos.BezierCurve : null); m_end_scale.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_end_scale.AnimatePer, m_end_scale.OverrideAnimatePerOption), m_start_scale.Values); CalculateLetterAnchorOffset(); }
public void PrepareData(int num_letters, int num_words, int num_lines, LetterAction prev_action, AnimatePerOptions animate_per, bool prev_action_end_state = true) { m_static_position = false; m_static_rotation = false; m_static_scale = false; m_static_colour = false; m_duration_progression.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_duration_progression.m_animate_per, m_duration_progression.m_override_animate_per_option)); if (m_audio_on_start != null) { m_audio_on_start_volume.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_audio_on_start_volume.m_animate_per, m_audio_on_start_volume.m_override_animate_per_option)); m_audio_on_start_offset.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_audio_on_start_offset.m_animate_per, m_audio_on_start_offset.m_override_animate_per_option)); m_audio_on_start_delay.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_audio_on_start_delay.m_animate_per, m_audio_on_start_delay.m_override_animate_per_option)); m_audio_on_start_pitch.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_audio_on_start_pitch.m_animate_per, m_audio_on_start_pitch.m_override_animate_per_option)); } if (m_audio_on_finish != null) { m_audio_on_finish_volume.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_audio_on_finish_volume.m_animate_per, m_audio_on_finish_volume.m_override_animate_per_option)); m_audio_on_finish_offset.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_audio_on_finish_offset.m_animate_per, m_audio_on_finish_offset.m_override_animate_per_option)); m_audio_on_finish_delay.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_audio_on_finish_delay.m_animate_per, m_audio_on_finish_delay.m_override_animate_per_option)); m_audio_on_finish_pitch.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_audio_on_finish_pitch.m_animate_per, m_audio_on_finish_pitch.m_override_animate_per_option)); } if (m_emitter_on_start != null) { m_emitter_on_start_offset.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_emitter_on_start_offset.m_animate_per, m_emitter_on_start_offset.m_override_animate_per_option), null); m_emitter_on_start_delay.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_emitter_on_start_delay.m_animate_per, m_emitter_on_start_delay.m_override_animate_per_option)); m_emitter_on_start_duration.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_emitter_on_start_duration.m_animate_per, m_emitter_on_start_duration.m_override_animate_per_option)); } if (m_emitter_on_finish != null) { m_emitter_on_finish_offset.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_emitter_on_finish_offset.m_animate_per, m_emitter_on_finish_offset.m_override_animate_per_option), null); m_emitter_on_finish_delay.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_emitter_on_finish_delay.m_animate_per, m_emitter_on_finish_delay.m_override_animate_per_option)); m_emitter_on_finish_duration.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_emitter_on_finish_duration.m_animate_per, m_emitter_on_finish_duration.m_override_animate_per_option)); } if (m_action_type == ACTION_TYPE.BREAK) { return; } m_delay_progression.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_delay_progression.m_animate_per, m_delay_progression.m_override_animate_per_option)); if (m_offset_from_last && prev_action != null) { m_use_gradient_start = prev_action.m_use_gradient_end || prev_action.m_use_gradient; if (prev_action_end_state) { if (m_use_gradient_start) { m_start_vertex_colour.m_values = prev_action.m_end_vertex_colour.m_values; } else { m_start_colour.m_values = prev_action.m_end_colour.m_values; } } else { if (m_use_gradient_start) { m_start_vertex_colour.m_values = prev_action.m_start_vertex_colour.m_values; } else { m_start_colour.m_values = prev_action.m_start_colour.m_values; } } } else { if (m_use_gradient_start || m_use_gradient || (prev_action != null && (prev_action.m_use_gradient_end || prev_action.m_use_gradient))) { if (!m_use_gradient_start && !m_use_gradient) { // Need to convert flat colour into a vertex colour m_use_gradient_start = true; m_use_gradient = false; m_start_vertex_colour.ConvertFromFlatColourProg(m_start_colour); } // add this colour to previous state m_start_vertex_colour.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_start_vertex_colour.m_animate_per, m_start_vertex_colour.m_override_animate_per_option), prev_action != null && (prev_action.m_use_gradient_end || prev_action.m_use_gradient) ? prev_action.m_end_vertex_colour.m_values : null, prev_action != null && (!prev_action.m_use_gradient_end && !prev_action.m_use_gradient) ? prev_action.m_end_colour.m_values : null); } else { m_start_colour.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_start_colour.m_animate_per, m_start_colour.m_override_animate_per_option), prev_action != null ? prev_action.m_end_colour.m_values : null); } } if (m_use_gradient_end || m_use_gradient || m_use_gradient_start || m_use_gradient) { if (!m_use_gradient_end && !m_use_gradient) { // Need to convert flat colour into a vertex colour m_use_gradient_end = true; m_use_gradient = false; m_end_vertex_colour.ConvertFromFlatColourProg(m_end_colour); } m_end_vertex_colour.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_end_vertex_colour.m_animate_per, m_end_vertex_colour.m_override_animate_per_option), (m_use_gradient_start || m_use_gradient) ? m_start_vertex_colour.m_values : null, (!m_use_gradient_start && !m_use_gradient) ? m_start_colour.m_values : null); } else { m_end_colour.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_end_colour.m_animate_per, m_end_colour.m_override_animate_per_option), m_start_colour.m_values); } // Static Colour check if (m_use_gradient_start && m_use_gradient_end && m_start_vertex_colour.m_values.Length == 1 && m_end_vertex_colour.m_values.Length == 1 && m_start_vertex_colour.GetValue(0).Equals(m_end_vertex_colour.GetValue(0))) { m_static_colour = true; // Debug.LogError("Static vertex colours"); } else if (!m_use_gradient_start && !m_use_gradient_end && m_start_colour.m_values.Length == 1 && m_end_colour.m_values.Length == 1 && m_start_colour.GetValue(0).Equals(m_end_colour.GetValue(0))) { m_static_colour = true; // Debug.LogError("Static flat colours"); } if (m_offset_from_last && prev_action != null) { m_start_pos.m_values = prev_action_end_state ? prev_action.m_end_pos.m_values : prev_action.m_start_pos.m_values; m_start_euler_rotation.m_values = prev_action_end_state ? prev_action.m_end_euler_rotation.m_values : prev_action.m_start_euler_rotation.m_values; m_start_scale.m_values = prev_action_end_state ? prev_action.m_end_scale.m_values : prev_action.m_start_scale.m_values; } else { m_start_pos.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_start_pos.m_animate_per, m_start_pos.m_override_animate_per_option), prev_action != null ? prev_action.m_end_pos.m_values : new Vector3[] { Vector3.zero }); m_start_euler_rotation.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_start_euler_rotation.m_animate_per, m_start_euler_rotation.m_override_animate_per_option), prev_action != null ? prev_action.m_end_euler_rotation.m_values : new Vector3[] { Vector3.zero }); m_start_scale.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_start_scale.m_animate_per, m_start_scale.m_override_animate_per_option), prev_action != null ? prev_action.m_end_scale.m_values : new Vector3[] { Vector3.zero }); } m_end_pos.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_end_pos.m_animate_per, m_end_pos.m_override_animate_per_option), m_start_pos.m_values); m_end_euler_rotation.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_end_euler_rotation.m_animate_per, m_end_euler_rotation.m_override_animate_per_option), m_start_euler_rotation.m_values); m_end_scale.CalculateProgressions(GetProgressionTotal(num_letters, num_words, num_lines, animate_per, m_end_scale.m_animate_per, m_end_scale.m_override_animate_per_option), m_start_scale.m_values); if (m_start_pos.m_values.Length == 1 && m_end_pos.m_values.Length == 1 && m_start_pos.m_values[0].Equals(m_end_pos.m_values[0]) && m_start_pos.m_force_position_override == m_end_pos.m_force_position_override) { m_static_position = true; // Debug.Log("Static positions"); } if (m_start_euler_rotation.m_values.Length == 1 && m_end_euler_rotation.m_values.Length == 1 && m_start_euler_rotation.m_values[0].Equals(m_end_euler_rotation.m_values[0])) { m_static_rotation = true; // Debug.Log("Static rotations"); } if (m_start_scale.m_values.Length == 1 && m_end_scale.m_values.Length == 1 && m_start_scale.m_values[0].Equals(m_end_scale.m_values[0])) { m_static_scale = true; // Debug.Log("Static scales"); } }