Функционал кошмаров

This commit is contained in:
Евгений Титаренко 2024-08-25 14:39:39 +03:00
parent 4222af1896
commit a87871a704
5 changed files with 58 additions and 4 deletions

View file

@ -17,6 +17,7 @@ public partial class Day : Node2D
private Player _player;
private ColorRect _colorRect;
private AudioStreamPlayer _music;
private AudioStreamPlayer _nightmare;
private Interactable _endDay;
private double _transitionTimeout = 0;
@ -27,6 +28,7 @@ public partial class Day : Node2D
_player = (Player)FindChild("Player");
_colorRect = _player.CRect;
_music = (AudioStreamPlayer)FindChild("Music");
_nightmare = (AudioStreamPlayer)FindChild("Nightmare");
_endDay = (Interactable)FindChild("EndDay");
_colorRect.Color = new Color(0, 0, 0, 1f);
_music.VolumeDb = -40;
@ -52,6 +54,11 @@ public partial class Day : Node2D
{
_endDay.Enable();
}
public void ChangeScene()
{
GetNode<SceneManager>("/root/SceneManager").SwitchScene(NextScene);
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
@ -82,7 +89,7 @@ public partial class Day : Node2D
}
else
{
GetNode<SceneManager>("/root/SceneManager").SwitchScene(NextScene);
_nightmare.Play();
}
}
}