ajout de la porte et équilibrage des mutations
This commit is contained in:
@@ -13,14 +13,18 @@ const RAY_LENGTH = 10.
|
||||
var cockpit_action_hovered : Interactable3D = null
|
||||
var query_mouse := false
|
||||
|
||||
@export var controlling_player = true
|
||||
|
||||
func _ready():
|
||||
Dialogic.timeline_started.connect(
|
||||
func():
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
controlling_player = false
|
||||
)
|
||||
Dialogic.timeline_ended.connect(
|
||||
func():
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
controlling_player = true
|
||||
)
|
||||
|
||||
func _input(event):
|
||||
@@ -34,32 +38,33 @@ func _input(event):
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
if query_mouse:
|
||||
update_mouse_hovered_cockpit_actions()
|
||||
%PointerTexture.texture = (
|
||||
POINTER_ACTION_TEXTURE if cockpit_action_hovered != null
|
||||
else POINTER_TEXTURE
|
||||
)
|
||||
query_mouse = false
|
||||
if controlling_player:
|
||||
if query_mouse:
|
||||
update_mouse_hovered_cockpit_actions()
|
||||
%PointerTexture.texture = (
|
||||
POINTER_ACTION_TEXTURE if cockpit_action_hovered != null
|
||||
else POINTER_TEXTURE
|
||||
)
|
||||
query_mouse = false
|
||||
|
||||
# Add the gravity.
|
||||
if not is_on_floor():
|
||||
velocity += get_gravity() * delta
|
||||
# Add the gravity.
|
||||
if not is_on_floor():
|
||||
velocity += get_gravity() * delta
|
||||
|
||||
# Get the input direction and handle the movement/deceleration.
|
||||
# As good practice, you should replace UI actions with custom gameplay actions.
|
||||
var input_dir = Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
||||
if Input.is_action_pressed("move_pointer"):
|
||||
input_dir.y = -1
|
||||
var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
|
||||
if direction:
|
||||
velocity.x = direction.x * speed
|
||||
velocity.z = direction.z * speed
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, speed)
|
||||
velocity.z = move_toward(velocity.z, 0, speed)
|
||||
# Get the input direction and handle the movement/deceleration.
|
||||
# As good practice, you should replace UI actions with custom gameplay actions.
|
||||
var input_dir = Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
||||
if Input.is_action_pressed("move_pointer"):
|
||||
input_dir.y = -1
|
||||
var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
|
||||
if direction:
|
||||
velocity.x = direction.x * speed
|
||||
velocity.z = direction.z * speed
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, speed)
|
||||
velocity.z = move_toward(velocity.z, 0, speed)
|
||||
|
||||
move_and_slide()
|
||||
move_and_slide()
|
||||
|
||||
func update_mouse_hovered_cockpit_actions() -> void:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user