Переходы между днями

This commit is contained in:
Евгений Титаренко 2024-08-25 13:17:20 +03:00
parent 71502b0653
commit 26db1ea66d
4 changed files with 42 additions and 25 deletions

View file

@ -17,20 +17,26 @@ public partial class Day : Node2D
private Player _player;
private ColorRect _colorRect;
private AudioStreamPlayer _music;
private double _transitionTimeout = 0;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
_player = (Player)FindChild("Player");
_colorRect = (ColorRect)FindChild("ColorRect");
_colorRect = _player.CRect;
_music = (AudioStreamPlayer)FindChild("Music");
_colorRect.Color = new Color(0, 0, 0, 1f);
_music.VolumeDb = -40;
_player.CurrentState = Player.State.Wait;
}
public void ChangeDay()
{
_state = State.TransitionOut;
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
@ -60,7 +66,7 @@ public partial class Day : Node2D
}
else
{
GetNode<SceneManager>("/root/SceneManager").SwitchScene("Day1");
GetNode<SceneManager>("/root/SceneManager").SwitchScene(NextScene);
}
}
}