2024-09-24 11:59:54 +08:00
|
|
|
extends State
|
2024-09-25 11:52:36 +08:00
|
|
|
var init_position:Vector2=Vector2.ZERO
|
|
|
|
var target_y:float=200
|
|
|
|
var need_target:bool=false
|
2024-09-24 17:26:44 +08:00
|
|
|
func enter_state(n):
|
|
|
|
get_player().up()
|
2024-09-25 11:52:36 +08:00
|
|
|
need_target=get_player().need_target()
|
|
|
|
init_position=get_player().position
|
|
|
|
if n is Vector2:
|
|
|
|
init_position=n
|
2024-09-24 17:26:44 +08:00
|
|
|
pass
|
|
|
|
func update_state(delta):
|
|
|
|
get_player().position=get_player().get_parent().get_local_mouse_position()
|
2024-09-25 18:04:02 +08:00
|
|
|
var change_y=(init_position-get_player().get_parent().get_local_mouse_position()).y
|
2024-09-24 17:26:44 +08:00
|
|
|
if Input.is_action_just_released("mouse_left"):
|
2024-09-25 18:04:02 +08:00
|
|
|
if change_y>target_y and not need_target:
|
|
|
|
change_to_state("queue",null)
|
|
|
|
return
|
|
|
|
else:
|
|
|
|
change_to_state("selected_back")
|
|
|
|
return
|
2024-09-24 17:26:44 +08:00
|
|
|
if Input.is_action_just_pressed("mouse_right"):
|
|
|
|
change_to_state("selected_back")
|
|
|
|
return
|
2024-09-25 11:52:36 +08:00
|
|
|
if need_target and change_y>target_y:
|
|
|
|
change_to_state("select_target",init_position)
|
|
|
|
return
|
2024-09-25 18:04:02 +08:00
|
|
|
|
2024-09-24 17:26:44 +08:00
|
|
|
pass
|
|
|
|
func update_state_phy(delta):
|
|
|
|
pass
|
|
|
|
func exit_state():
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
func time_out():
|
|
|
|
pass
|
|
|
|
func process_message(type:String,n):
|
|
|
|
|
|
|
|
|
|
|
|
pass
|