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.
		
		
		
		
		
			
	
	
		
			
				
					
						
							|  |  |  | extends Control | 
					
						
							|  |  |  | class_name HitText | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @onready var animation: AnimationPlayer = %AnimationPlayer as AnimationPlayer | 
					
						
							|  |  |  | @onready var label: Label = %Label as Label | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | var damage_cache: float | 
					
						
							|  |  |  | var is_close: bool | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func show_hit_damage(damage: float): | 
					
						
							|  |  |  |     if is_close: | 
					
						
							|  |  |  |         print("正在使用已关闭的hit_text") | 
					
						
							|  |  |  |     damage_cache += damage | 
					
						
							|  |  |  |     label.text = "%d" % damage_cache | 
					
						
							|  |  |  |     animation.seek(0) | 
					
						
							|  |  |  |     animation.play("stage1") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func show_hit_text(text_set: String): | 
					
						
							|  |  |  |     if is_close: | 
					
						
							|  |  |  |         print("正在使用已关闭的hit_text") | 
					
						
							|  |  |  |     is_close = true | 
					
						
							|  |  |  |     label.text = text_set | 
					
						
							|  |  |  |     animation.play("stage3") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func _on_animation_player_animation_finished(anim_name): | 
					
						
							|  |  |  |     match anim_name: | 
					
						
							|  |  |  |         "stage1": | 
					
						
							|  |  |  |             is_close = true | 
					
						
							|  |  |  |             animation.play("stage2_%d" % randi_range(1, 4)) | 
					
						
							|  |  |  |         "stage2_1", "stage2_2", "stage2_3", "stage2_4": | 
					
						
							|  |  |  |             queue_free() | 
					
						
							|  |  |  |         "stage3": | 
					
						
							|  |  |  |             queue_free() |