init
This commit is contained in:
commit
b99855351d
434 changed files with 50357 additions and 0 deletions
23
scripts/npc/npc.gd
Normal file
23
scripts/npc/npc.gd
Normal file
|
@ -0,0 +1,23 @@
|
|||
extends CharacterBody3D
|
||||
|
||||
@export var text: Resource
|
||||
var moving: bool
|
||||
|
||||
func animate_move():
|
||||
$Model/AnimationPlayer.play("walk")
|
||||
|
||||
func animate_idle():
|
||||
$Model/AnimationPlayer.play("idle")
|
||||
|
||||
# Dummy function to avoid having to distinct npc from pickup
|
||||
func pointing(point: bool): pass
|
||||
func destroy(): pass
|
||||
|
||||
func get_text() -> Resource:
|
||||
if moving:
|
||||
return null
|
||||
else:
|
||||
return text
|
||||
|
||||
func is_photo() -> bool:
|
||||
return false
|
29
scripts/npc/npc_path_follow.gd
Normal file
29
scripts/npc/npc_path_follow.gd
Normal file
|
@ -0,0 +1,29 @@
|
|||
extends Path3D
|
||||
|
||||
var can_move: bool
|
||||
@export var maxSpeed = 0.01
|
||||
|
||||
var pos = 0.0;
|
||||
@onready var character_body_3d = $PathFollow3D/CharacterBody3D
|
||||
|
||||
@export var character_id: String
|
||||
|
||||
func _ready():
|
||||
DialogueManager.dialogue_finished.connect(_quit_dialogue)
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
var previous_pos = pos;
|
||||
character_body_3d.moving = can_move
|
||||
if can_move and pos < 1:
|
||||
pos += maxSpeed * delta
|
||||
|
||||
if previous_pos != pos:
|
||||
character_body_3d.animate_move()
|
||||
else:
|
||||
character_body_3d.animate_idle()
|
||||
|
||||
$PathFollow3D.progress_ratio = clamp(pos, 0, 1)
|
||||
|
||||
func _quit_dialogue(_time_to_add: int):
|
||||
can_move = !character_id.is_empty() && DialogueManager.global_variables[character_id];
|
21
scripts/npc/photo.gd
Normal file
21
scripts/npc/photo.gd
Normal file
|
@ -0,0 +1,21 @@
|
|||
extends Control
|
||||
|
||||
@export var photos: Array[Texture2D]
|
||||
@export var photo_sound: Array[AudioStream]
|
||||
@export var destroy_sound: AudioStream
|
||||
|
||||
var is_visible = false
|
||||
|
||||
func show_picture(index: int):
|
||||
is_visible = true
|
||||
$FotoTest.texture = photos[index]
|
||||
$AnimationPlayer.play("appear")
|
||||
$AudioStreamPlayer.stream = photo_sound.pick_random()
|
||||
$AudioStreamPlayer.play()
|
||||
|
||||
func hide_picture():
|
||||
if !is_visible: return
|
||||
$AnimationPlayer.play("disappear")
|
||||
is_visible = false
|
||||
$AudioStreamPlayer.stream = destroy_sound
|
||||
$AudioStreamPlayer.play()
|
27
scripts/npc/pickup.gd
Normal file
27
scripts/npc/pickup.gd
Normal file
|
@ -0,0 +1,27 @@
|
|||
extends CharacterBody3D
|
||||
|
||||
@export var text: Resource
|
||||
@export var photo_index: int = 0
|
||||
|
||||
@export var animation_payer: AnimationPlayer
|
||||
|
||||
func _ready():
|
||||
animation_payer.play("photo_hover")
|
||||
|
||||
func pointing(point: bool):
|
||||
if point:
|
||||
animation_payer.play("photo_point", 1)
|
||||
else:
|
||||
animation_payer.play("photo_hover", 1)
|
||||
|
||||
func get_text() -> Resource:
|
||||
return text;
|
||||
|
||||
func destroy():
|
||||
queue_free()
|
||||
|
||||
func is_photo():
|
||||
return true
|
||||
|
||||
func get_photo_index():
|
||||
return photo_index
|
Loading…
Add table
Add a link
Reference in a new issue