chill-jam-10-2024/scripts/Day1Cutscene.cs

50 lines
1 KiB
C#

using Godot;
using System;
public partial class Day1Cutscene : Node2D
{
private Player _player;
private NPC _npc1;
private NPC _npc2;
private AudioStreamPlayer _spook;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
_npc1 = (NPC)FindChild("NPC1");
_npc2 = (NPC)FindChild("NPC2");
_spook = (AudioStreamPlayer)FindChild("Spook");
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
public void Stage1(Node2D body)
{
if (body is Player player)
{
_player = player;
player.InteractableObjects.Add(_npc1);
player.CurrentState = Player.State.ChatWithNPC;
}
}
public void Stage2()
{
_player.CurrentState = Player.State.Wait;
_player.InteractableObjects.Remove(_npc1);
AudioServer.SetBusVolumeDb(0, -20);
_spook.Play();
_player.InteractableObjects.Add(_npc2);
}
public void Stage3()
{
AudioServer.SetBusVolumeDb(0, 0);
_player.CurrentState = Player.State.ChatWithNPC;
}
}