public ParticleEffectInstanceManager(EffectManager effect_manager, Mesh character_mesh, bool letter_flipped, ParticleEffectSetup effect_setup, AnimationProgressionVariables progression_vars, AnimatePerOptions animate_per, ParticleEmitter particle_emitter = null, ParticleSystem particle_system = null)
		{
			m_particle_emitter = particle_emitter;
			m_particle_system = particle_system;
			m_letter_mesh = character_mesh;
			m_letter_flipped = letter_flipped;
			m_follow_mesh = effect_setup.m_follow_mesh;
			m_duration = effect_setup.m_duration.GetValue(progression_vars, animate_per);
			m_delay = effect_setup.m_delay.GetValue(progression_vars, animate_per);
			m_position_offset = effect_setup.m_position_offset.GetValue(progression_vars, animate_per);
			m_rotation_offset = Quaternion.Euler(effect_setup.m_rotation_offset.GetValue(progression_vars, animate_per));
			m_rotate_with_letter = effect_setup.m_rotate_relative_to_letter;
			m_effect_manager_handle = effect_manager;
			m_active = false;

			if(m_particle_emitter != null)
			{
				m_transform = m_particle_emitter.transform;

				m_particle_emitter.emit = true;
				m_particle_emitter.enabled = false;
			}
			else if(m_particle_system != null)
			{
				m_transform = m_particle_system.transform;

				m_particle_system.playOnAwake = false;
				m_particle_system.Play();
	#if !UNITY_3_5 && UNITY_EDITOR
				p_system_timer = 0;
	#endif
			}
		}
        public void AddParticleEffectSetup(ParticleEffectSetup particle_setup)
        {
            if (m_particle_effects == null)
            {
                m_particle_effects = new List <ParticleEffectSetup>();
            }

            m_particle_effects.Add(particle_setup);
        }
        public ParticleEffectSetup AddParticleEffectSetup()
        {
            if (m_particle_effects == null)
            {
                m_particle_effects = new List <ParticleEffectSetup>();
            }

            ParticleEffectSetup new_particle_effect = new ParticleEffectSetup();

            m_particle_effects.Add(new_particle_effect);

            return(new_particle_effect);
        }
        public void ImportData(JSONObject json_data)
        {
            m_action_type           = (ACTION_TYPE)(int)json_data["m_action_type"].Number;
            m_ease_type             = (EasingEquation)(int)json_data["m_ease_type"].Number;
            m_use_gradient_start    = json_data["m_use_gradient_start"].Boolean;
            m_use_gradient_end      = json_data["m_use_gradient_end"].Boolean;
            m_force_same_start_time = json_data["m_force_same_start_time"].Boolean;
            m_letter_anchor_start   = (int)json_data["m_letter_anchor_start"].Number;
            m_letter_anchor_end     = (int)json_data["m_letter_anchor_end"].Number;
            m_letter_anchor_2_way   = json_data["m_letter_anchor_2_way"].Boolean;
            m_offset_from_last      = json_data["m_offset_from_last"].Boolean;
            m_position_axis_ease_data.ImportData(json_data["m_position_axis_ease_data"].Obj);
            m_rotation_axis_ease_data.ImportData(json_data["m_rotation_axis_ease_data"].Obj);
            m_scale_axis_ease_data.ImportData(json_data["m_scale_axis_ease_data"].Obj);

            if (m_use_gradient_start)
            {
                m_start_vertex_colour.ImportData(json_data["m_start_vertex_colour"].Obj);
            }
            else
            {
                m_start_colour.ImportData(json_data["m_start_colour"].Obj);
            }
            if (m_use_gradient_end)
            {
                m_end_vertex_colour.ImportData(json_data["m_end_vertex_colour"].Obj);
            }
            else
            {
                m_end_colour.ImportData(json_data["m_end_colour"].Obj);
            }

            m_start_euler_rotation.ImportData(json_data["m_start_euler_rotation"].Obj);
            m_end_euler_rotation.ImportData(json_data["m_end_euler_rotation"].Obj);
            m_start_pos.ImportData(json_data["m_start_pos"].Obj);
            m_end_pos.ImportData(json_data["m_end_pos"].Obj);
            m_start_scale.ImportData(json_data["m_start_scale"].Obj);
            m_end_scale.ImportData(json_data["m_end_scale"].Obj);
            m_delay_progression.ImportData(json_data["m_delay_progression"].Obj);
            m_duration_progression.ImportData(json_data["m_duration_progression"].Obj);


            m_audio_effects = new List <AudioEffectSetup>();
            AudioEffectSetup audio_effect;

            foreach (JSONValue audio_data in json_data["AUDIO_EFFECTS_DATA"].Array)
            {
                audio_effect = new AudioEffectSetup();
                audio_effect.ImportData(audio_data.Obj);
                m_audio_effects.Add(audio_effect);
            }

            m_particle_effects = new List <ParticleEffectSetup>();
            ParticleEffectSetup particle_effect;

            foreach (JSONValue particle_data in json_data["PARTICLE_EFFECTS_DATA"].Array)
            {
                particle_effect = new ParticleEffectSetup();
                particle_effect.ImportData(particle_data.Obj);
                m_particle_effects.Add(particle_effect);
            }
        }
Exemplo n.º 5
0
		public void ImportData(JSONObject json_data)
		{	
			m_action_type = (ACTION_TYPE) (int) json_data["m_action_type"].Number;
			m_ease_type = (EasingEquation) (int) json_data["m_ease_type"].Number;
			m_use_gradient_start = json_data["m_use_gradient_start"].Boolean;
			m_use_gradient_end = json_data["m_use_gradient_end"].Boolean;
			m_force_same_start_time = json_data["m_force_same_start_time"].Boolean;
			m_letter_anchor_start = (int) json_data["m_letter_anchor_start"].Number;
			m_letter_anchor_end = (int) json_data["m_letter_anchor_end"].Number;
			m_letter_anchor_2_way = json_data["m_letter_anchor_2_way"].Boolean;
			m_offset_from_last = json_data["m_offset_from_last"].Boolean;
			m_position_axis_ease_data.ImportData(json_data["m_position_axis_ease_data"].Obj);
			m_rotation_axis_ease_data.ImportData(json_data["m_rotation_axis_ease_data"].Obj);
			m_scale_axis_ease_data.ImportData(json_data["m_scale_axis_ease_data"].Obj);
			
			if(m_use_gradient_start)
				m_start_vertex_colour.ImportData(json_data["m_start_vertex_colour"].Obj);
			else
				m_start_colour.ImportData(json_data["m_start_colour"].Obj);
			if(m_use_gradient_end)
				m_end_vertex_colour.ImportData(json_data["m_end_vertex_colour"].Obj);
			else
				m_end_colour.ImportData(json_data["m_end_colour"].Obj);
			
			m_start_euler_rotation.ImportData(json_data["m_start_euler_rotation"].Obj);
			m_end_euler_rotation.ImportData(json_data["m_end_euler_rotation"].Obj);
			m_start_pos.ImportData(json_data["m_start_pos"].Obj);
			m_end_pos.ImportData(json_data["m_end_pos"].Obj);
			m_start_scale.ImportData(json_data["m_start_scale"].Obj);
			m_end_scale.ImportData(json_data["m_end_scale"].Obj);
			m_delay_progression.ImportData(json_data["m_delay_progression"].Obj);
			m_duration_progression.ImportData(json_data["m_duration_progression"].Obj);
			
			
			m_audio_effects = new List<AudioEffectSetup>();
			AudioEffectSetup audio_effect;
			foreach(JSONValue audio_data in json_data["AUDIO_EFFECTS_DATA"].Array)
			{
				audio_effect = new AudioEffectSetup();
				audio_effect.ImportData(audio_data.Obj);
				m_audio_effects.Add(audio_effect);
			}
			
			m_particle_effects = new List<ParticleEffectSetup>();
			ParticleEffectSetup particle_effect;
			foreach(JSONValue particle_data in json_data["PARTICLE_EFFECTS_DATA"].Array)
			{
				particle_effect = new ParticleEffectSetup();
				particle_effect.ImportData(particle_data.Obj);
				m_particle_effects.Add(particle_effect);
			}
		}
Exemplo n.º 6
0
		public void AddParticleEffectSetup(ParticleEffectSetup particle_setup)
		{
			if(m_particle_effects == null)
				m_particle_effects = new List<ParticleEffectSetup>();
			
			m_particle_effects.Add(particle_setup);
		}
Exemplo n.º 7
0
		public ParticleEffectSetup AddParticleEffectSetup()
		{
			if(m_particle_effects == null)
				m_particle_effects = new List<ParticleEffectSetup>();
			
			ParticleEffectSetup new_particle_effect = new ParticleEffectSetup();
			m_particle_effects.Add(new_particle_effect);
			
			return new_particle_effect;
		}
		public static int ImportLegacyData (this LetterAction letter_action, List<object> data_list, int index_offset = 0)
		{
			KeyValuePair<string, string> value_pair;
			string key, value;
			int idx;
			
			letter_action.ClearAudioEffectSetups();
			letter_action.ClearParticleEffectSetups();
			
			AudioEffectSetup audio_setup = null;
			ParticleEffectSetup effect_setup = null;
			
			for(idx = index_offset; idx < data_list.Count; idx++)
			{
				value_pair = (KeyValuePair<string, string>) data_list[idx];
				key = value_pair.Key;
				value = value_pair.Value;
				
				if(key.Equals("ACTION_DATA_END"))
				{
					// reached end of this Actions import data
					break;
				}

				switch(key)
				{
					case "m_action_type":
						letter_action.m_action_type = (ACTION_TYPE) int.Parse(value); break;
					case "m_ease_type":
						letter_action.m_ease_type = (EasingEquation) int.Parse(value); break;
					case "m_use_gradient_start":
						letter_action.m_use_gradient_start = bool.Parse(value); break;
					case "m_use_gradient_end":
						letter_action.m_use_gradient_end = bool.Parse(value); break;
					case "m_force_same_start_time":
						letter_action.m_force_same_start_time = bool.Parse(value); break;
					// Legacy letter anchor import support
					case "m_letter_anchor":
						letter_action.m_letter_anchor_start = int.Parse(value);
						letter_action.m_letter_anchor_2_way = false;	
						break;
					
					// New letter anchor import support
					case "m_letter_anchor_start":
						letter_action.m_letter_anchor_start = int.Parse(value);break;
					case "m_letter_anchor_end":
						letter_action.m_letter_anchor_end = int.Parse(value);break;
					case "m_letter_anchor_2_way":
						letter_action.m_letter_anchor_2_way = bool.Parse(value); break;
					
					
					case "m_offset_from_last":
						letter_action.m_offset_from_last = bool.Parse(value); break;
					case "m_position_axis_ease_data":
						letter_action.m_position_axis_ease_data.ImportLegacyData(value); break;
					case "m_rotation_axis_ease_data":
						letter_action.m_rotation_axis_ease_data.ImportLegacyData(value); break;
					case "m_scale_axis_ease_data":
						letter_action.m_scale_axis_ease_data.ImportLegacyData(value); break;


					case "m_start_colour":
						letter_action.m_start_colour.ImportLegacyData(value); break;
					case "m_end_colour":
						letter_action.m_end_colour.ImportLegacyData(value); break;
					case "m_start_vertex_colour":
						letter_action.m_start_vertex_colour.ImportLegacyData(value); break;
					case "m_end_vertex_colour":
						letter_action.m_end_vertex_colour.ImportLegacyData(value); break;
					case "m_start_euler_rotation":
						letter_action.m_start_euler_rotation.ImportLegacyData(value); break;
					case "m_end_euler_rotation":
						letter_action.m_end_euler_rotation.ImportLegacyData(value); break;
					case "m_start_pos":
						letter_action.m_start_pos.ImportLegacyData(value); break;
					case "m_end_pos":
						letter_action.m_end_pos.ImportLegacyData(value); break;
					case "m_start_scale":
						letter_action.m_start_scale.ImportLegacyData(value); break;
					case "m_end_scale":
						letter_action.m_end_scale.ImportLegacyData(value); break;
					case "m_delay_progression":
						letter_action.m_delay_progression.ImportLegacyData(value); break;
					case "m_duration_progression":
						letter_action.m_duration_progression.ImportLegacyData(value); break;
						
					
					case "m_audio_on_start":
						if(value.PathToAudioClip() != null)
						{
							audio_setup = new AudioEffectSetup() { m_audio_clip = value.PathToAudioClip(), m_play_when = PLAY_ITEM_EVENTS.ON_START, m_effect_assignment = PLAY_ITEM_ASSIGNMENT.PER_LETTER, m_loop_play_once = false };
						}
						break;
					case "m_audio_on_start_delay":
						if(audio_setup != null)
							audio_setup.m_delay.ImportLegacyData(value); break;
					case "m_audio_on_start_offset":
						if(audio_setup != null)
							audio_setup.m_offset_time.ImportLegacyData(value); break;
					case "m_audio_on_start_pitch":
						if(audio_setup != null)
							audio_setup.m_pitch.ImportLegacyData(value); break;
					case "m_audio_on_start_volume":
						if(audio_setup != null)
						{
							audio_setup.m_volume.ImportLegacyData(value);
							letter_action.AddAudioEffectSetup(audio_setup);
							audio_setup = null;
						}
						break;
					
					case "m_audio_on_finish":
						if(value.PathToAudioClip() != null)
						{
							audio_setup = new AudioEffectSetup() { m_audio_clip = value.PathToAudioClip(), m_play_when = PLAY_ITEM_EVENTS.ON_FINISH, m_effect_assignment = PLAY_ITEM_ASSIGNMENT.PER_LETTER, m_loop_play_once = false };
						}
						break;
					case "m_audio_on_finish_delay":
						if(audio_setup != null)
							audio_setup.m_delay.ImportLegacyData(value);
						break;
					case "m_audio_on_finish_offset":
						if(audio_setup != null)
							audio_setup.m_offset_time.ImportLegacyData(value);
						break;
					case "m_audio_on_finish_pitch":
						if(audio_setup != null)
							audio_setup.m_pitch.ImportLegacyData(value);
						break;
					case "m_audio_on_finish_volume":
						if(audio_setup != null)
						{
							audio_setup.m_volume.ImportLegacyData(value);
							letter_action.AddAudioEffectSetup(audio_setup);
							audio_setup = null;
						}
						break;
					
					
					// BACKWARDS COMPATIBILITY PARTICLE IMPORT
					case "m_emitter_on_start":
						if(value.PathToParticleEmitter() != null)
						{
							effect_setup = new ParticleEffectSetup()
							{
								m_legacy_particle_effect = value.PathToParticleEmitter(),
								m_play_when = PLAY_ITEM_EVENTS.ON_START,
								m_loop_play_once = false,
								m_rotation_offset = new ActionVector3Progression(new Vector3(0,180,0)),
								m_rotate_relative_to_letter = true,
								m_effect_type = PARTICLE_EFFECT_TYPE.LEGACY
							};
						}
						break;
					case "m_emitter_on_start_delay":
						if(effect_setup != null)
							effect_setup.m_delay.ImportLegacyData(value);
						break;
					case "m_emitter_on_start_duration":
						if(effect_setup != null)
							effect_setup.m_duration.ImportLegacyData(value);
						break;
					case "m_emitter_on_start_follow_mesh":
						if(effect_setup != null)
							effect_setup.m_follow_mesh = bool.Parse(value);
						break;
					case "m_emitter_on_start_offset":
						if(effect_setup != null)
							effect_setup.m_position_offset.ImportLegacyData(value);
						break;
					case "m_emitter_on_start_per_letter":
						if(effect_setup != null)
						{
							effect_setup.m_effect_assignment = bool.Parse(value) ? PLAY_ITEM_ASSIGNMENT.PER_LETTER : PLAY_ITEM_ASSIGNMENT.CUSTOM;
							if(effect_setup.m_effect_assignment == PLAY_ITEM_ASSIGNMENT.CUSTOM)
								effect_setup.m_effect_assignment_custom_letters = new List<int>(){0};
						
							letter_action.AddParticleEffectSetup(effect_setup);
							effect_setup = null;
						}
						break;
					
					case "m_emitter_on_finish":
						if(value.PathToParticleEmitter() != null)
						{
							effect_setup = new ParticleEffectSetup()
							{
								m_legacy_particle_effect = value.PathToParticleEmitter(),
								m_play_when = PLAY_ITEM_EVENTS.ON_FINISH,
								m_loop_play_once = false,
								m_rotation_offset = new ActionVector3Progression(new Vector3(0,180,0)),
								m_rotate_relative_to_letter = true,
								m_effect_type = PARTICLE_EFFECT_TYPE.LEGACY
							};
						}
						break;
					case "m_emitter_on_finish_delay":
						if(effect_setup != null)
							effect_setup.m_delay.ImportLegacyData(value);
						break;
					case "m_emitter_on_finish_duration":
						if(effect_setup != null)
							effect_setup.m_duration.ImportLegacyData(value);
						break;
					case "m_emitter_on_finish_follow_mesh":
						if(effect_setup != null)
							effect_setup.m_follow_mesh = bool.Parse(value);
						break;
					case "m_emitter_on_finish_offset":
						if(effect_setup != null)
							effect_setup.m_position_offset.ImportLegacyData(value);
						break;
					case "m_emitter_on_finish_per_letter":
						if(effect_setup != null)
						{
							effect_setup.m_effect_assignment = bool.Parse(value) ? PLAY_ITEM_ASSIGNMENT.PER_LETTER : PLAY_ITEM_ASSIGNMENT.CUSTOM;
							if(effect_setup.m_effect_assignment == PLAY_ITEM_ASSIGNMENT.CUSTOM)
								effect_setup.m_effect_assignment_custom_letters = new List<int>(){0};
						
							letter_action.AddParticleEffectSetup(effect_setup);
							effect_setup = null;
						}
						break;
				}
			}

			return idx;
		}
Exemplo n.º 9
0
        public static int ImportLegacyData(this LetterAction letter_action, List <object> data_list, int index_offset = 0)
        {
            KeyValuePair <string, string> value_pair;
            string key, value;
            int    idx;

            letter_action.ClearAudioEffectSetups();
            letter_action.ClearParticleEffectSetups();

            AudioEffectSetup    audio_setup  = null;
            ParticleEffectSetup effect_setup = null;

            for (idx = index_offset; idx < data_list.Count; idx++)
            {
                value_pair = (KeyValuePair <string, string>)data_list[idx];
                key        = value_pair.Key;
                value      = value_pair.Value;

                if (key.Equals("ACTION_DATA_END"))
                {
                    // reached end of this Actions import data
                    break;
                }

                switch (key)
                {
                case "m_action_type":
                    letter_action.m_action_type = (ACTION_TYPE)int.Parse(value); break;

                case "m_ease_type":
                    letter_action.m_ease_type = (EasingEquation)int.Parse(value); break;

                case "m_use_gradient_start":
                    letter_action.m_use_gradient_start = bool.Parse(value); break;

                case "m_use_gradient_end":
                    letter_action.m_use_gradient_end = bool.Parse(value); break;

                case "m_force_same_start_time":
                    letter_action.m_force_same_start_time = bool.Parse(value); break;

                // Legacy letter anchor import support
                case "m_letter_anchor":
                    letter_action.m_letter_anchor_start = int.Parse(value);
                    letter_action.m_letter_anchor_2_way = false;
                    break;

                // New letter anchor import support
                case "m_letter_anchor_start":
                    letter_action.m_letter_anchor_start = int.Parse(value); break;

                case "m_letter_anchor_end":
                    letter_action.m_letter_anchor_end = int.Parse(value); break;

                case "m_letter_anchor_2_way":
                    letter_action.m_letter_anchor_2_way = bool.Parse(value); break;


                case "m_offset_from_last":
                    letter_action.m_offset_from_last = bool.Parse(value); break;

                case "m_position_axis_ease_data":
                    letter_action.m_position_axis_ease_data.ImportLegacyData(value); break;

                case "m_rotation_axis_ease_data":
                    letter_action.m_rotation_axis_ease_data.ImportLegacyData(value); break;

                case "m_scale_axis_ease_data":
                    letter_action.m_scale_axis_ease_data.ImportLegacyData(value); break;


                case "m_start_colour":
                    letter_action.m_start_colour.ImportLegacyData(value); break;

                case "m_end_colour":
                    letter_action.m_end_colour.ImportLegacyData(value); break;

                case "m_start_vertex_colour":
                    letter_action.m_start_vertex_colour.ImportLegacyData(value); break;

                case "m_end_vertex_colour":
                    letter_action.m_end_vertex_colour.ImportLegacyData(value); break;

                case "m_start_euler_rotation":
                    letter_action.m_start_euler_rotation.ImportLegacyData(value); break;

                case "m_end_euler_rotation":
                    letter_action.m_end_euler_rotation.ImportLegacyData(value); break;

                case "m_start_pos":
                    letter_action.m_start_pos.ImportLegacyData(value); break;

                case "m_end_pos":
                    letter_action.m_end_pos.ImportLegacyData(value); break;

                case "m_start_scale":
                    letter_action.m_start_scale.ImportLegacyData(value); break;

                case "m_end_scale":
                    letter_action.m_end_scale.ImportLegacyData(value); break;

                case "m_delay_progression":
                    letter_action.m_delay_progression.ImportLegacyData(value); break;

                case "m_duration_progression":
                    letter_action.m_duration_progression.ImportLegacyData(value); break;


                case "m_audio_on_start":
                    if (value.PathToAudioClip() != null)
                    {
                        audio_setup = new AudioEffectSetup()
                        {
                            m_audio_clip = value.PathToAudioClip(), m_play_when = PLAY_ITEM_EVENTS.ON_START, m_effect_assignment = PLAY_ITEM_ASSIGNMENT.PER_LETTER, m_loop_play_once = false
                        };
                    }
                    break;

                case "m_audio_on_start_delay":
                    if (audio_setup != null)
                    {
                        audio_setup.m_delay.ImportLegacyData(value);
                    }
                    break;

                case "m_audio_on_start_offset":
                    if (audio_setup != null)
                    {
                        audio_setup.m_offset_time.ImportLegacyData(value);
                    }
                    break;

                case "m_audio_on_start_pitch":
                    if (audio_setup != null)
                    {
                        audio_setup.m_pitch.ImportLegacyData(value);
                    }
                    break;

                case "m_audio_on_start_volume":
                    if (audio_setup != null)
                    {
                        audio_setup.m_volume.ImportLegacyData(value);
                        letter_action.AddAudioEffectSetup(audio_setup);
                        audio_setup = null;
                    }
                    break;

                case "m_audio_on_finish":
                    if (value.PathToAudioClip() != null)
                    {
                        audio_setup = new AudioEffectSetup()
                        {
                            m_audio_clip = value.PathToAudioClip(), m_play_when = PLAY_ITEM_EVENTS.ON_FINISH, m_effect_assignment = PLAY_ITEM_ASSIGNMENT.PER_LETTER, m_loop_play_once = false
                        };
                    }
                    break;

                case "m_audio_on_finish_delay":
                    if (audio_setup != null)
                    {
                        audio_setup.m_delay.ImportLegacyData(value);
                    }
                    break;

                case "m_audio_on_finish_offset":
                    if (audio_setup != null)
                    {
                        audio_setup.m_offset_time.ImportLegacyData(value);
                    }
                    break;

                case "m_audio_on_finish_pitch":
                    if (audio_setup != null)
                    {
                        audio_setup.m_pitch.ImportLegacyData(value);
                    }
                    break;

                case "m_audio_on_finish_volume":
                    if (audio_setup != null)
                    {
                        audio_setup.m_volume.ImportLegacyData(value);
                        letter_action.AddAudioEffectSetup(audio_setup);
                        audio_setup = null;
                    }
                    break;


                // BACKWARDS COMPATIBILITY PARTICLE IMPORT
                case "m_emitter_on_start":
                    if (value.PathToParticleEmitter() != null)
                    {
                        effect_setup = new ParticleEffectSetup()
                        {
                            m_legacy_particle_effect = value.PathToParticleEmitter(),
                            m_play_when                 = PLAY_ITEM_EVENTS.ON_START,
                            m_loop_play_once            = false,
                            m_rotation_offset           = new ActionVector3Progression(new Vector3(0, 180, 0)),
                            m_rotate_relative_to_letter = true,
                            m_effect_type               = PARTICLE_EFFECT_TYPE.LEGACY
                        };
                    }
                    break;

                case "m_emitter_on_start_delay":
                    if (effect_setup != null)
                    {
                        effect_setup.m_delay.ImportLegacyData(value);
                    }
                    break;

                case "m_emitter_on_start_duration":
                    if (effect_setup != null)
                    {
                        effect_setup.m_duration.ImportLegacyData(value);
                    }
                    break;

                case "m_emitter_on_start_follow_mesh":
                    if (effect_setup != null)
                    {
                        effect_setup.m_follow_mesh = bool.Parse(value);
                    }
                    break;

                case "m_emitter_on_start_offset":
                    if (effect_setup != null)
                    {
                        effect_setup.m_position_offset.ImportLegacyData(value);
                    }
                    break;

                case "m_emitter_on_start_per_letter":
                    if (effect_setup != null)
                    {
                        effect_setup.m_effect_assignment = bool.Parse(value) ? PLAY_ITEM_ASSIGNMENT.PER_LETTER : PLAY_ITEM_ASSIGNMENT.CUSTOM;
                        if (effect_setup.m_effect_assignment == PLAY_ITEM_ASSIGNMENT.CUSTOM)
                        {
                            effect_setup.m_effect_assignment_custom_letters = new List <int>()
                            {
                                0
                            }
                        }
                        ;

                        letter_action.AddParticleEffectSetup(effect_setup);
                        effect_setup = null;
                    }
                    break;

                case "m_emitter_on_finish":
                    if (value.PathToParticleEmitter() != null)
                    {
                        effect_setup = new ParticleEffectSetup()
                        {
                            m_legacy_particle_effect = value.PathToParticleEmitter(),
                            m_play_when                 = PLAY_ITEM_EVENTS.ON_FINISH,
                            m_loop_play_once            = false,
                            m_rotation_offset           = new ActionVector3Progression(new Vector3(0, 180, 0)),
                            m_rotate_relative_to_letter = true,
                            m_effect_type               = PARTICLE_EFFECT_TYPE.LEGACY
                        };
                    }
                    break;

                case "m_emitter_on_finish_delay":
                    if (effect_setup != null)
                    {
                        effect_setup.m_delay.ImportLegacyData(value);
                    }
                    break;

                case "m_emitter_on_finish_duration":
                    if (effect_setup != null)
                    {
                        effect_setup.m_duration.ImportLegacyData(value);
                    }
                    break;

                case "m_emitter_on_finish_follow_mesh":
                    if (effect_setup != null)
                    {
                        effect_setup.m_follow_mesh = bool.Parse(value);
                    }
                    break;

                case "m_emitter_on_finish_offset":
                    if (effect_setup != null)
                    {
                        effect_setup.m_position_offset.ImportLegacyData(value);
                    }
                    break;

                case "m_emitter_on_finish_per_letter":
                    if (effect_setup != null)
                    {
                        effect_setup.m_effect_assignment = bool.Parse(value) ? PLAY_ITEM_ASSIGNMENT.PER_LETTER : PLAY_ITEM_ASSIGNMENT.CUSTOM;
                        if (effect_setup.m_effect_assignment == PLAY_ITEM_ASSIGNMENT.CUSTOM)
                        {
                            effect_setup.m_effect_assignment_custom_letters = new List <int>()
                            {
                                0
                            }
                        }
                        ;

                        letter_action.AddParticleEffectSetup(effect_setup);
                        effect_setup = null;
                    }
                    break;
                }
            }

            return(idx);
        }
        public ParticleEffectInstanceManager(EffectManager effect_manager, Mesh character_mesh, bool letter_flipped, ParticleEffectSetup effect_setup, AnimationProgressionVariables progression_vars, AnimatePerOptions animate_per, ParticleEmitter particle_emitter = null, ParticleSystem particle_system = null)
        {
            m_particle_emitter      = particle_emitter;
            m_particle_system       = particle_system;
            m_letter_mesh           = character_mesh;
            m_letter_flipped        = letter_flipped;
            m_follow_mesh           = effect_setup.m_follow_mesh;
            m_duration              = effect_setup.m_duration.GetValue(progression_vars, animate_per);
            m_delay                 = effect_setup.m_delay.GetValue(progression_vars, animate_per);
            m_position_offset       = effect_setup.m_position_offset.GetValue(progression_vars, animate_per);
            m_rotation_offset       = Quaternion.Euler(effect_setup.m_rotation_offset.GetValue(progression_vars, animate_per));
            m_rotate_with_letter    = effect_setup.m_rotate_relative_to_letter;
            m_effect_manager_handle = effect_manager;
            m_active                = false;

            if (m_particle_emitter != null)
            {
                m_transform = m_particle_emitter.transform;

                m_particle_emitter.emit    = true;
                m_particle_emitter.enabled = false;
            }
            else if (m_particle_system != null)
            {
                m_transform = m_particle_system.transform;

                m_particle_system.playOnAwake = false;
                m_particle_system.Play();
        #if !UNITY_3_5 && UNITY_EDITOR
                p_system_timer = 0;
        #endif
            }
        }
Exemplo n.º 11
0
		public void PlayParticleEffect(Mesh character_mesh, bool m_letter_flipped, ParticleEffectSetup effect_setup, AnimationProgressionVariables progression_vars, AnimatePerOptions animate_per)
		{
			bool effect_played = false;

			if(effect_setup.m_legacy_particle_effect != null)
			{
				if(m_particle_emitters == null)
				{
					m_particle_emitters = new List<ParticleEmitter>();
				}

				foreach(ParticleEmitter p_emitter in m_particle_emitters)
				{
					if(!p_emitter.emit && p_emitter.particleCount == 0 && p_emitter.name.Equals(effect_setup.m_legacy_particle_effect.name + "(Clone)"))
					{
						m_effect_managers.Add(new ParticleEffectInstanceManager(this, character_mesh, m_letter_flipped, effect_setup, progression_vars, animate_per, particle_emitter : p_emitter));
						
						effect_played = true;
						break;
					}
				}

				if(!effect_played)
				{
					ParticleEmitter p_emitter = GameObject.Instantiate(effect_setup.m_legacy_particle_effect) as ParticleEmitter;
					m_particle_emitters.Add(p_emitter);
					p_emitter.gameObject.SetActive(true);
					p_emitter.emit = false;
					p_emitter.transform.parent = this.transform;
					
					m_effect_managers.Add(new ParticleEffectInstanceManager(this, character_mesh, m_letter_flipped, effect_setup, progression_vars, animate_per, particle_emitter : p_emitter));
				}
			}
			else if(effect_setup.m_shuriken_particle_effect != null)
			{
				if(m_particle_systems == null)
					m_particle_systems = new List<ParticleSystem>();
				
				foreach(ParticleSystem p_system in m_particle_systems)
				{
					// check if particle system instance is currently not being used, and if it's the same type of effect that we're looking for.
					if(!p_system.isPlaying && p_system.particleCount == 0 && p_system.name.Equals(effect_setup.m_shuriken_particle_effect.name + "(Clone)"))
					{
						m_effect_managers.Add(new ParticleEffectInstanceManager(this, character_mesh, m_letter_flipped, effect_setup, progression_vars, animate_per, particle_system : p_system));
						
						effect_played = true;
						break;
					}
				}

				if(!effect_played)
				{
					// Make a new instance of the particleSystem effect and add to pool
					ParticleSystem p_system = GameObject.Instantiate(effect_setup.m_shuriken_particle_effect) as ParticleSystem;
					m_particle_systems.Add(p_system);
					p_system.gameObject.SetActive(true);
					p_system.playOnAwake = false;
					p_system.Stop();
					p_system.transform.parent = this.transform;
					
					m_effect_managers.Add(new ParticleEffectInstanceManager(this, character_mesh, m_letter_flipped, effect_setup, progression_vars, animate_per, particle_system : p_system));
				}
			}
		}