87 lines
2.6 KiB
GDScript
87 lines
2.6 KiB
GDScript
extends Node
|
|
|
|
@onready var mapNode = get_node("/root/tutorial")
|
|
var mapPath = "res://scenes/tutorial.tscn"
|
|
var audio_stream_player = AudioStreamPlayer.new()
|
|
@onready var environment = get_node("WorldEnvironment").get_environment()
|
|
|
|
func _ready():
|
|
Global.currentMapNode = mapNode
|
|
Global.currentMapPath = mapPath
|
|
Global.playerHealth = 100
|
|
Global.fatigue = 100
|
|
Global.roundTimer = 90.0
|
|
Global.tutorialCompleted = true
|
|
Global.save_data()
|
|
|
|
|
|
func _process(delta):
|
|
if Input.is_action_just_released("menu"):
|
|
$VideoStreamPlayer.stop()
|
|
$skipLabel.visible = false
|
|
if $VideoStreamPlayer.is_playing():
|
|
Global.playerDisable = true
|
|
$skipLabel.visible = true
|
|
else:
|
|
Global.playerDisable = false
|
|
$skipLabel.visible = false
|
|
if Global.tutorialComplete and not Global.tutorialTimerCompleted:
|
|
if audio_stream_player.playing == false:
|
|
var randomnum = RandomNumberGenerator.new().randi_range(0, 6)
|
|
if randomnum == 0:
|
|
play_music(load("res://music/alexander-nakarada-chase.mp3"))
|
|
Global.musicName = "Chase"
|
|
Global.musicAuthor = "Alexander Nakarada"
|
|
elif randomnum == 1:
|
|
play_music(load("res://music/DRIVE.mp3"))
|
|
Global.musicName = "DRIVE"
|
|
Global.musicAuthor = "Alex-Productions"
|
|
elif randomnum == 2:
|
|
play_music(load("res://music/Fluffing-a-Duck.mp3"))
|
|
Global.musicName = "Fluffing a Duck"
|
|
Global.musicAuthor = "Kevin MacLeod"
|
|
elif randomnum == 3:
|
|
play_music(load("res://music/Monkeys-Spinning-Monkeys.mp3"))
|
|
Global.musicName = "Monkeys Spinning Monkeys"
|
|
Global.musicAuthor = "Kevin MacLeod"
|
|
elif randomnum == 4:
|
|
play_music(load("res://music/Run-Amok.mp3"))
|
|
Global.musicName = "Run Amok"
|
|
Global.musicAuthor = "Kevin MacLeod"
|
|
elif randomnum == 5:
|
|
play_music(load("res://music/Sneaky-Snitch.mp3"))
|
|
Global.musicName = "Sneaky Snitch"
|
|
Global.musicAuthor = "Kevin MacLeod"
|
|
elif randomnum == 6:
|
|
play_music(load("res://music/Wallpaper.mp3"))
|
|
Global.musicName = "Wallpaper"
|
|
Global.musicAuthor = "Kevin MacLeod"
|
|
else:
|
|
print("This shouldn't ever be called, toyland.gd")
|
|
Global.musicUpdated = true
|
|
if Global.tutorialTimerCompleted:
|
|
audio_stream_player.playing = false
|
|
change_time_of_day()
|
|
|
|
|
|
func play_music(music):
|
|
audio_stream_player.set_stream(music)
|
|
add_child(audio_stream_player)
|
|
audio_stream_player.play()
|
|
|
|
var num = 1
|
|
var day = true
|
|
var sensitivity = 0.00025
|
|
|
|
func change_time_of_day():
|
|
if num <= 1 and day:
|
|
num = num - sensitivity
|
|
if num <= 0.05:
|
|
day = false
|
|
elif num >= 0 and not day:
|
|
num = num + sensitivity
|
|
if num >= 1:
|
|
day = true
|
|
environment.background_energy_multiplier = num
|
|
environment.ambient_light_sky_contribution = num
|
|
$DirectionalLight3D.light_energy = num
|