You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			43 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			GDScript
		
	
			
		
		
	
	
			43 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			GDScript
		
	
| extends EffectBase
 | |
| class_name Particle
 | |
| 
 | |
| var sub_particle_list: Array[Particle]
 | |
| var particle_list: Array[GPUParticles3D]
 | |
| var speed_scale_list: Array[Variant] = []
 | |
| var decal_list: Array[Variant]       = []
 | |
| 
 | |
| 
 | |
| func on_ready():
 | |
|     for child in get_children():
 | |
|         if child is Particle:
 | |
|             sub_particle_list.append(child)
 | |
|         elif child is GPUParticles3D:
 | |
|             var particle: GPUParticles3D = child as GPUParticles3D
 | |
|             particle_list.append(particle)
 | |
|             speed_scale_list.append(particle.speed_scale)
 | |
|             particle.restart()
 | |
|         elif child is ParticleDecal:
 | |
|             decal_list.append(child)
 | |
|         else:
 | |
|             continue
 | |
|         if child.lifetime > lifetime_now:
 | |
|             lifetime_now = child.lifetime
 | |
| 
 | |
|     for particle: GPUParticles3D in particle_list:
 | |
|         if particle.lifetime > lifetime_now:
 | |
|             lifetime_now = particle.lifetime
 | |
| 
 | |
| 
 | |
| func on_process(delta: float):
 | |
|     for decal: ParticleDecal in decal_list:
 | |
|         decal.on_process(delta)
 | |
| 
 | |
| 
 | |
| func on_set_pause(is_pause_set: bool):
 | |
|     for i in range(len(particle_list)):
 | |
|         var particle: GPUParticles3D = particle_list[i]
 | |
|         var speed_scale              = speed_scale_list[i]
 | |
|         particle.speed_scale = 0 if is_pause else speed_scale
 | |
|     for sub_particle: Particle in sub_particle_list:
 | |
|         sub_particle.set_pause(is_pause_set)
 |