103 lines
3.5 KiB
GDScript
103 lines
3.5 KiB
GDScript
extends Node
|
|
|
|
var player
|
|
var corinne
|
|
var music_player # pour balavoine
|
|
|
|
# pour corinne-help
|
|
|
|
func _ready() -> void:
|
|
#Dialogic.timeline_ended.connect(set_player_cam)
|
|
pass
|
|
|
|
func change_cinematic_cam(camera_name:String):
|
|
var all_cinematic_cams:Array = get_tree().get_nodes_in_group("cinematic_cams")
|
|
for cam in all_cinematic_cams:
|
|
if cam.name == camera_name:
|
|
cam.make_current()
|
|
# car cinematic
|
|
if cam.name == "deathseat":
|
|
var audio = cam.get_parent().get_node("AudioStreamPlayer3D")
|
|
audio.stream = load("res://assets/audio/sound-effects/car/inside-car.mp3")
|
|
audio.play()
|
|
elif cam.name == "road_view":
|
|
var audio = cam.get_parent().get_node("AudioStreamPlayer3D")
|
|
audio.stream = load("res://assets/audio/sound-effects/car/outside-car.wav")
|
|
audio.play()
|
|
elif cam.name == "frog_view":
|
|
var audio = cam.get_parent().get_node("AudioStreamPlayer3D")
|
|
audio.stream = load("res://assets/audio/sound-effects/car/inside-car.mp3")
|
|
audio.play()
|
|
elif cam.name == "top_view":
|
|
var audio = cam.get_parent().get_node("AudioStreamPlayer3D")
|
|
audio.stream = load("res://assets/audio/sound-effects/car/outside-car.wav")
|
|
audio.play()
|
|
|
|
# other cinematics
|
|
elif cam.name == "croissants":
|
|
corinne = get_tree().get_first_node_in_group("corinne")
|
|
var marker_player = cam.get_node("MarkerPlayer")
|
|
var marker_corinne = cam.get_node("MarkerCorinne")
|
|
|
|
player.global_position = marker_player.global_position
|
|
player.global_rotation = marker_player.global_rotation
|
|
|
|
corinne.global_position = marker_corinne.global_position
|
|
corinne.global_rotation = marker_corinne.global_rotation
|
|
player.anim_player.play("Idling")
|
|
corinne.anim_player.play("Idling")
|
|
|
|
music_player.global_position = cam.global_position
|
|
elif cam.name == "stairs":
|
|
var path_follow = cam.get_node("Path3D").get_node("PathFollow3D")
|
|
corinne.reparent( path_follow )
|
|
corinne.position = Vector3.ZERO
|
|
corinne.rotation = Vector3.ZERO
|
|
|
|
var tween := create_tween()
|
|
tween.tween_property(path_follow, "progress_ratio", 1.0, 35)
|
|
tween.finished.connect( corinne.reactivate_area3D )
|
|
corinne.anim_player.play( "walking" )
|
|
|
|
music_player.global_position = cam.global_position
|
|
elif cam.name == "large":
|
|
var marker_player = cam.get_node("MarkerPlayer")
|
|
|
|
#player = get_tree().get_first_node_in_group("player")
|
|
#corinne = get_tree().get_first_node_in_group("corinne")
|
|
#music_player = player.musique
|
|
|
|
player.global_position = marker_player.global_position
|
|
player.global_rotation = marker_player.global_rotation
|
|
|
|
music_player.global_position = cam.global_position
|
|
elif cam.name == "watermill":
|
|
music_player.global_position = cam.global_position
|
|
elif cam.name == "city":
|
|
var marker_player = cam.get_node("MarkerPlayer")
|
|
var marker_corinne = cam.get_node("MarkerCorinne")
|
|
|
|
player.global_position = marker_player.global_position
|
|
player.global_rotation = marker_player.global_rotation
|
|
|
|
corinne.global_position = marker_corinne.global_position
|
|
corinne.global_rotation = marker_corinne.global_rotation
|
|
player.anim_player.play("Idling")
|
|
corinne.anim_player.play("Idling")
|
|
|
|
music_player.global_position = cam.global_position
|
|
|
|
return
|
|
|
|
|
|
func set_player_cam(pov:bool=true):
|
|
if !player:
|
|
player = get_tree().get_first_node_in_group("player")
|
|
if pov:
|
|
player.set_pov_cam()
|
|
else:
|
|
player.set_default_cam()
|
|
music_player = player.musique
|
|
player.reset_musique_position()
|
|
|