wip: new action prompt can now play scenes
This commit is contained in:
parent
d5e23b80a0
commit
d5b20eef6c
|
|
@ -82,4 +82,4 @@ func _on_playback_finished():
|
||||||
Scenes.player_enable.emit(true)
|
Scenes.player_enable.emit(true)
|
||||||
|
|
||||||
func handle(event: InputEvent):
|
func handle(event: InputEvent):
|
||||||
viewport.push_input(event)
|
viewport.push_input(event)
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
[ext_resource type="PackedScene" uid="uid://mkccbig41bqb" path="res://logic-scenes/player_controller/player_controller.tscn" id="3_foj4y"]
|
[ext_resource type="PackedScene" uid="uid://mkccbig41bqb" path="res://logic-scenes/player_controller/player_controller.tscn" id="3_foj4y"]
|
||||||
[ext_resource type="AudioStream" uid="uid://bbpo1hu35yer8" path="res://base-environments/youth_room/import/sounds/thunder.mp3" id="3_wcypa"]
|
[ext_resource type="AudioStream" uid="uid://bbpo1hu35yer8" path="res://base-environments/youth_room/import/sounds/thunder.mp3" id="3_wcypa"]
|
||||||
[ext_resource type="Script" uid="uid://c281w7earok6w" path="res://base-environments/youth_room/crouch_volume.gd" id="3_x3dlb"]
|
[ext_resource type="Script" uid="uid://c281w7earok6w" path="res://base-environments/youth_room/crouch_volume.gd" id="3_x3dlb"]
|
||||||
[ext_resource type="Script" uid="uid://hji6r2e8mcqo" path="res://base-environments/youth_room/climb_volume.gd" id="4_dqyng"]
|
[ext_resource type="Script" path="res://base-environments/youth_room/climb_volume.gd" id="4_dqyng"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bnskiyx1sksww" path="res://logic-scenes/board/physics-board.tscn" id="4_gyjxx"]
|
[ext_resource type="PackedScene" uid="uid://bnskiyx1sksww" path="res://logic-scenes/board/physics-board.tscn" id="4_gyjxx"]
|
||||||
[ext_resource type="AudioStream" uid="uid://1tvopjmo6dp2" path="res://base-environments/youth_room/audio/Azure Studios - mgd-723687677.mp3" id="5_fe1yj"]
|
[ext_resource type="AudioStream" uid="uid://1tvopjmo6dp2" path="res://base-environments/youth_room/audio/Azure Studios - mgd-723687677.mp3" id="5_fe1yj"]
|
||||||
[ext_resource type="PackedScene" uid="uid://citwb7f4dl3l1" path="res://thank-you.tscn" id="5_kts6y"]
|
[ext_resource type="PackedScene" uid="uid://citwb7f4dl3l1" path="res://thank-you.tscn" id="5_kts6y"]
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,13 @@
|
||||||
class_name Interactable extends Node3D
|
class_name Interactable extends Node3D
|
||||||
|
|
||||||
@export var interaction_ui: PackedScene = null
|
@export var interaction: PackedScene = null
|
||||||
|
var interaction_ui : Control = null
|
||||||
|
|
||||||
@onready var view: Node3D = $View
|
@onready var view: Node3D = $View
|
||||||
@onready var frame: Sprite3D = $Frame
|
@onready var frame: Sprite3D = $Frame
|
||||||
|
@onready var canvas_layer: CanvasLayer = $CanvasLayer
|
||||||
|
|
||||||
|
var active : bool = true
|
||||||
var shown : bool = false
|
var shown : bool = false
|
||||||
var hover : bool = false
|
var hover : bool = false
|
||||||
var collected : bool = false
|
var collected : bool = false
|
||||||
|
|
@ -14,6 +17,13 @@ var tween: Tween = null
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
view.scale = Vector3.ZERO
|
view.scale = Vector3.ZERO
|
||||||
frame.modulate.a = 0
|
frame.modulate.a = 0
|
||||||
|
if interaction:
|
||||||
|
interaction_ui = interaction.instantiate() as Control
|
||||||
|
canvas_layer.add_child(interaction_ui)
|
||||||
|
Scenes.player_enable.connect(_player_active) # TODO: do I have to clean this up?
|
||||||
|
|
||||||
|
func _player_active(value: bool) -> void:
|
||||||
|
active = value
|
||||||
|
|
||||||
func _process(_delta: float) -> void:
|
func _process(_delta: float) -> void:
|
||||||
_process_hover()
|
_process_hover()
|
||||||
|
|
@ -25,7 +35,7 @@ func _process_billboard() -> void:
|
||||||
look_at(player_view.global_position, Vector3.UP, true)
|
look_at(player_view.global_position, Vector3.UP, true)
|
||||||
|
|
||||||
func _process_hover() -> void:
|
func _process_hover() -> void:
|
||||||
if hover and not shown:
|
if active and hover and not shown:
|
||||||
shown = true
|
shown = true
|
||||||
view.scale = Vector3.ZERO
|
view.scale = Vector3.ZERO
|
||||||
frame.modulate = Color.TRANSPARENT
|
frame.modulate = Color.TRANSPARENT
|
||||||
|
|
@ -36,7 +46,7 @@ func _process_hover() -> void:
|
||||||
tween.parallel().tween_property(view, "rotation:z", 0, 0.8).set_delay(0.5)
|
tween.parallel().tween_property(view, "rotation:z", 0, 0.8).set_delay(0.5)
|
||||||
tween.parallel().tween_property(frame, "modulate:a", 1.0, 2.0)
|
tween.parallel().tween_property(frame, "modulate:a", 1.0, 2.0)
|
||||||
|
|
||||||
elif not hover and shown:
|
elif not hover and shown or shown and not active:
|
||||||
shown = false
|
shown = false
|
||||||
if tween: tween.kill()
|
if tween: tween.kill()
|
||||||
tween = create_tween().set_ease(Tween.EASE_IN).set_trans(Tween.TRANS_BACK)
|
tween = create_tween().set_ease(Tween.EASE_IN).set_trans(Tween.TRANS_BACK)
|
||||||
|
|
@ -44,6 +54,40 @@ func _process_hover() -> void:
|
||||||
tween.parallel().tween_property(frame, "modulate:a", 0, 0.6)
|
tween.parallel().tween_property(frame, "modulate:a", 0, 0.6)
|
||||||
|
|
||||||
func _input(event: InputEvent) -> void:
|
func _input(event: InputEvent) -> void:
|
||||||
if hover and shown and event is InputEventMouseButton and event.is_action_pressed("ui_select"):
|
if not active or not hover or not shown: return
|
||||||
collected = true
|
print(event, event.is_action_pressed("ui_accept"))
|
||||||
|
var clicked : bool = (event.is_action_pressed("ui_accept")) or (event is InputEventMouseButton and event.pressed)
|
||||||
|
|
||||||
|
if hover and shown and clicked:
|
||||||
|
collect_memento()
|
||||||
|
|
||||||
|
|
||||||
|
func collect_memento() -> void:
|
||||||
|
shown = false
|
||||||
|
collected = true
|
||||||
|
|
||||||
|
# Hide mouse and collapse other interactables BEFORE showing canvas
|
||||||
|
get_tree().call_group("interactables", "collapse")
|
||||||
|
|
||||||
|
# Show the CanvasLayer so the story is visible full-screen
|
||||||
|
canvas_layer.show()
|
||||||
|
|
||||||
|
if interaction_ui is StoryPlayable:
|
||||||
|
Input.mouse_mode = Input.MOUSE_MODE_HIDDEN
|
||||||
|
|
||||||
|
canvas_layer.show()
|
||||||
|
Scenes.begin_sequence(interaction_ui.scene_id)
|
||||||
|
|
||||||
|
# Play the story
|
||||||
|
await interaction_ui.play()
|
||||||
|
|
||||||
|
# Pick the cards
|
||||||
|
var picker := State.room.get_node("%Picker") as CardPicker
|
||||||
|
await picker.pick_cards(interaction_ui.scene_id, false)
|
||||||
|
|
||||||
|
# Hide the CanvasLayer when done
|
||||||
|
canvas_layer.hide()
|
||||||
|
Scenes.end_sequence(interaction_ui.scene_id) # todo: maybe later?
|
||||||
|
|
||||||
|
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||||
|
Scenes.player_enable.emit(true) # TODO: this may not be our job?
|
||||||
|
|
|
||||||
|
|
@ -76,3 +76,4 @@ shape = SubResource("SphereShape3D_3rbj1")
|
||||||
[node name="collectable_particles" parent="." instance=ExtResource("6_a6wx8")]
|
[node name="collectable_particles" parent="." instance=ExtResource("6_a6wx8")]
|
||||||
|
|
||||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||||
|
visible = false
|
||||||
|
|
|
||||||
|
|
@ -124,13 +124,13 @@ func play():
|
||||||
print_debug("StoryPlayable.gd: %s.play()" % self.name)
|
print_debug("StoryPlayable.gd: %s.play()" % self.name)
|
||||||
|
|
||||||
# There's an ugly glitch here.
|
# There's an ugly glitch here.
|
||||||
hide()
|
hide()
|
||||||
animation_player.play("RESET")
|
animation_player.play("RESET")
|
||||||
await animation_player.animation_finished
|
await animation_player.animation_finished
|
||||||
|
|
||||||
# Show ourselves before playing
|
# Show ourselves before playing
|
||||||
get_parent().show() # Ensure visible Canvaslayer!
|
get_parent().show() # Ensure visible Canvaslayer!
|
||||||
|
|
||||||
scroll_target = 0
|
scroll_target = 0
|
||||||
|
|
||||||
# FIXME: find out why this needs to be set to prevent scenes from being fully revealed
|
# FIXME: find out why this needs to be set to prevent scenes from being fully revealed
|
||||||
|
|
@ -147,10 +147,10 @@ func play():
|
||||||
await get_tree().process_frame
|
await get_tree().process_frame
|
||||||
show()
|
show()
|
||||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||||
|
|
||||||
# Don't know how to do this.
|
# Don't know how to do this.
|
||||||
#%StoryScroll.grab_focus()
|
#%StoryScroll.grab_focus()
|
||||||
|
|
||||||
if name == "draven":
|
if name == "draven":
|
||||||
await get_tree().process_frame
|
await get_tree().process_frame
|
||||||
$AnimationPlayer/Music.play()
|
$AnimationPlayer/Music.play()
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
[gd_scene load_steps=16 format=3 uid="uid://d0x27tf7y5keu"]
|
[gd_scene load_steps=17 format=3 uid="uid://d0x27tf7y5keu"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://mkccbig41bqb" path="res://logic-scenes/player_controller/player_controller.tscn" id="1_oayv8"]
|
[ext_resource type="PackedScene" uid="uid://mkccbig41bqb" path="res://logic-scenes/player_controller/player_controller.tscn" id="1_oayv8"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dreokijo757l1" path="res://logic-scenes/interactable/interactable.tscn" id="2_nl0nc"]
|
[ext_resource type="PackedScene" uid="uid://dreokijo757l1" path="res://logic-scenes/interactable/interactable.tscn" id="2_nl0nc"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c3l8tm8ku50vt" path="res://base-environments/youth_room/scenes/childhood.tscn" id="3_am5gj"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bw47g00bi710i" path="res://base-environments/youth_room/youth_room_visuals.tscn" id="5_3rbj1"]
|
[ext_resource type="PackedScene" uid="uid://bw47g00bi710i" path="res://base-environments/youth_room/youth_room_visuals.tscn" id="5_3rbj1"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dwtxjvprjyx8p" path="res://base-environments/youth_room/lava-lamp.tscn" id="6_ggen3"]
|
[ext_resource type="PackedScene" uid="uid://dwtxjvprjyx8p" path="res://base-environments/youth_room/lava-lamp.tscn" id="6_ggen3"]
|
||||||
|
|
||||||
|
|
@ -199,6 +200,7 @@ shape = SubResource("WorldBoundaryShape3D_nl0nc")
|
||||||
|
|
||||||
[node name="Interactable" parent="." instance=ExtResource("2_nl0nc")]
|
[node name="Interactable" parent="." instance=ExtResource("2_nl0nc")]
|
||||||
transform = Transform3D(-1, 0, 1.509958e-07, 0, 1, 0, -1.509958e-07, 0, -1, 0.0017054975, 0.59263134, 2.5304449)
|
transform = Transform3D(-1, 0, 1.509958e-07, 0, 1, 0, -1.509958e-07, 0, -1, 0.0017054975, 0.59263134, 2.5304449)
|
||||||
|
interaction = ExtResource("3_am5gj")
|
||||||
|
|
||||||
[node name="visuals" parent="." instance=ExtResource("5_3rbj1")]
|
[node name="visuals" parent="." instance=ExtResource("5_3rbj1")]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue