Adaptive music and music 👍
This commit is contained in:
parent
a8ae482cbe
commit
dcffb97a3d
48 changed files with 603 additions and 24 deletions
24
scripts/ChooseYourSeedsMusic.cs
Normal file
24
scripts/ChooseYourSeedsMusic.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using Godot;
|
||||
using Newlon.Components.Level;
|
||||
|
||||
public partial class ChooseYourSeedsMusic : AudioStreamPlayer
|
||||
{
|
||||
public override void _Ready()
|
||||
{
|
||||
RuntimeLevelData.Instance.OnLevelStateChanged += OnLevelStateChanged;
|
||||
}
|
||||
|
||||
private void OnLevelStateChanged(RuntimeLevelData.LevelStates state)
|
||||
{
|
||||
if (state == RuntimeLevelData.LevelStates.ChooseYourSeeds)
|
||||
{
|
||||
Play();
|
||||
}
|
||||
else
|
||||
{
|
||||
var tween = CreateTween();
|
||||
tween.TweenProperty(this, "volume_linear", 0, 1);
|
||||
tween.TweenCallback(Callable.From(Stop));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue