public ParticleEffectInstanceManager(TextFxAnimationManager animation_manager, LetterSetup letter_setup_ref, 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_setup_ref = letter_setup_ref;
			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(null, progression_vars, animate_per);
			m_rotation_offset = Quaternion.Euler(effect_setup.m_rotation_offset.GetValue(null, progression_vars, animate_per));
			m_rotate_with_letter = effect_setup.m_rotate_relative_to_letter;
			m_animation_manager = animation_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;

				// Set the layer of the effect if an override is specified
				if(animation_manager.AnimationInterface.LayerOverride >= 0)
					m_particle_emitter.gameObject.layer = animation_manager.AnimationInterface.LayerOverride;
			}
			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

				// Set the layer of the effect if an override is specified
				if(animation_manager.AnimationInterface.LayerOverride >= 0)
					m_particle_system.gameObject.layer = animation_manager.AnimationInterface.LayerOverride;
			}
		}
示例#2
0
		public void ImportData(Boomlagoon.JSON.JSONObject json_data, string assetNameSuffix = "", float timing_scale = -1)
		{	
			m_action_type = (ACTION_TYPE) (int) json_data["m_action_type"].Number;
			m_ease_type = (EasingEquation) (int) json_data["m_ease_type"].Number;
			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);

			m_colour_transition_active = json_data.ContainsKey("m_colour_transition_active") ? json_data ["m_colour_transition_active"].Boolean : true;
			m_position_transition_active = json_data.ContainsKey("m_position_transition_active") ? json_data ["m_position_transition_active"].Boolean : true;
			m_local_rotation_transition_active = json_data.ContainsKey("m_local_rotation_transition_active") ? json_data ["m_local_rotation_transition_active"].Boolean : true;
			m_local_scale_transition_active = json_data.ContainsKey("m_local_scale_transition_active") ? json_data ["m_local_scale_transition_active"].Boolean : true;
			m_global_rotation_transition_active = json_data.ContainsKey("m_global_rotation_transition_active") ? json_data ["m_global_rotation_transition_active"].Boolean : true;
			m_global_scale_transition_active = json_data.ContainsKey("m_global_scale_transition_active") ? json_data ["m_global_scale_transition_active"].Boolean : true;


			if(json_data.ContainsKey("m_start_colour"))
				m_start_colour.ImportData(json_data["m_start_colour"].Obj);
			if(json_data.ContainsKey("m_end_colour"))
				m_end_colour.ImportData(json_data["m_end_colour"].Obj);

			if(json_data.ContainsKey("m_start_vertex_colour"))
				m_start_colour.ImportData(json_data["m_start_vertex_colour"].Obj);
			if(json_data.ContainsKey("m_end_vertex_colour"))
				m_start_colour.ImportData(json_data["m_end_vertex_colour"].Obj);

			if(json_data.ContainsKey("m_use_gradient_start"))
				// Legacy setting. Need to check for it for backwards compatibility
				m_start_colour.UseColourGradients = json_data["m_use_gradient_start"].Boolean;

			if(json_data.ContainsKey("m_use_gradient_end"))
				// Legacy setting. Need to check for it for backwards compatibility
				m_end_colour.UseColourGradients = json_data["m_use_gradient_end"].Boolean;

			
			m_start_pos.ImportData(json_data["m_start_pos"].Obj);
			m_end_pos.ImportData(json_data["m_end_pos"].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_scale.ImportData(json_data["m_start_scale"].Obj);
			m_end_scale.ImportData(json_data["m_end_scale"].Obj);

			m_global_start_euler_rotation.ImportData(json_data["m_global_start_euler_rotation"].Obj);
			m_global_end_euler_rotation.ImportData(json_data["m_global_end_euler_rotation"].Obj);
			m_global_start_scale.ImportData(json_data["m_global_start_scale"].Obj);
			m_global_end_scale.ImportData(json_data["m_global_end_scale"].Obj);

			m_duration_progression.ImportData(json_data["m_duration_progression"].Obj);
			m_delay_progression.ImportData(json_data["m_delay_progression"].Obj);

			if(timing_scale != -1)
			{
				// Scale delay easing by the provided timing scale
				if(m_delay_progression.Progression != (int) ValueProgression.Constant)
				{
					float from = m_delay_progression.ValueFrom;
					float to = m_delay_progression.ValueTo;
					float then = m_delay_progression.ValueThen;

					if(m_delay_progression.Progression == (int) ValueProgression.Eased)
					{
						if(m_delay_progression.UsingThirdValue)
							m_delay_progression.SetEased( from * timing_scale, to * timing_scale, then * timing_scale);
						else
							m_delay_progression.SetEased( from * timing_scale, to * timing_scale);
					}
					else if(m_delay_progression.Progression == (int) ValueProgression.EasedCustom)
					{
						m_delay_progression.SetEasedCustom( from * timing_scale, to * timing_scale);
					}
					else if(m_delay_progression.Progression == (int) ValueProgression.Random)
					{
						m_delay_progression.SetRandom( from * timing_scale, to * timing_scale, m_delay_progression.UniqueRandomRaw);
					}
				}
			}
			
			m_audio_effects = new List<AudioEffectSetup>();
			AudioEffectSetup audio_effect;
			foreach(Boomlagoon.JSON.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(Boomlagoon.JSON.JSONValue particle_data in json_data["PARTICLE_EFFECTS_DATA"].Array)
			{
				particle_effect = new ParticleEffectSetup();
				particle_effect.ImportData(particle_data.Obj, assetNameSuffix);
				m_particle_effects.Add(particle_effect);
			}
		}
示例#3
0
		public void AddParticleEffectSetup(ParticleEffectSetup particle_setup)
		{
			if(m_particle_effects == null)
				m_particle_effects = new List<ParticleEffectSetup>();
			
			m_particle_effects.Add(particle_setup);
		}
示例#4
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 void PlayParticleEffect(LetterSetup letter_setup, 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_particle_effect_managers.Add(new ParticleEffectInstanceManager(this, letter_setup, 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);
	#if !UNITY_3_5
					p_emitter.gameObject.SetActive(true);
	#else
					p_emitter.gameObject.SetActiveRecursively(true);
	#endif
					p_emitter.emit = false;
					p_emitter.transform.parent = m_transform;
					
					m_particle_effect_managers.Add(new ParticleEffectInstanceManager(this, letter_setup, 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_particle_effect_managers.Add(new ParticleEffectInstanceManager(this, letter_setup, 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);
	#if !UNITY_3_5
					p_system.gameObject.SetActive(true);
	#else
					p_system.gameObject.SetActiveRecursively(true);
	#endif
					p_system.playOnAwake = false;
					p_system.Stop();
					p_system.transform.parent = m_transform;
					
					m_particle_effect_managers.Add(new ParticleEffectInstanceManager(this, letter_setup, effect_setup, progression_vars, animate_per, particle_system : p_system));
				}
			}
		}