Катсцена для первого дня

This commit is contained in:
Евгений Титаренко 2024-08-25 16:02:48 +03:00
parent 47df3f9165
commit 32f09f08f3
6 changed files with 126 additions and 2 deletions

50
scripts/Day1Cutscene.cs Normal file
View file

@ -0,0 +1,50 @@
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;
}
}