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 Node3D | 
					
						
							|  |  |  | class_name PlayerAction | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @onready var test_bullet = load("res://config/character/bullet01.tres") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @onready var character = (get_owner() as Character) | 
					
						
							|  |  |  | @onready var status = (%Status as Status) | 
					
						
							|  |  |  | @onready var combo = (%Combo as Combo) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func check_action(key:String,is_pressed:bool) -> bool: | 
					
						
							|  |  |  | 	if is_pressed and check_action_pressed(key): | 
					
						
							|  |  |  | 		return true | 
					
						
							|  |  |  | 	match key: | 
					
						
							|  |  |  | 		"lock":lock(is_pressed) | 
					
						
							|  |  |  | 		"switch":switch(is_pressed) | 
					
						
							|  |  |  | 		_:return false | 
					
						
							|  |  |  | 	return true | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func check_action_pressed(key:String) -> bool: | 
					
						
							|  |  |  | 	match key: | 
					
						
							|  |  |  | 		"weapon_pre":combo.weapon_index_change(-1) | 
					
						
							|  |  |  | 		"weapon_next":combo.weapon_index_change(1) | 
					
						
							|  |  |  | 		"test_1": | 
					
						
							|  |  |  | 			Global.character_mgr.create_character(test_bullet,character.team(),character.pos()) | 
					
						
							|  |  |  | 		_:return false | 
					
						
							|  |  |  | 	return true | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func lock(is_pressed:bool): | 
					
						
							|  |  |  | 	var has_target = status.target != 0 | 
					
						
							|  |  |  | 	if is_pressed == has_target: | 
					
						
							|  |  |  | 		return | 
					
						
							|  |  |  | 	if is_pressed: | 
					
						
							|  |  |  | 		var enemy_list = Global.character_mgr.get_enemy_list(character.id()) | 
					
						
							|  |  |  | 		if enemy_list: | 
					
						
							|  |  |  | 			character.set_target(enemy_list[0].id()) | 
					
						
							|  |  |  | 	else: | 
					
						
							|  |  |  | 		character.set_target(0) | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | func switch(is_pressed:bool): | 
					
						
							|  |  |  | 	character.set_status("is_switch",is_pressed) |