Реализация случайной высоты звука (в том числе и для звуков ходьбы).
This commit is contained in:
parent
7ca54bdb38
commit
fec3f22665
3 changed files with 8 additions and 0 deletions
|
@ -14,6 +14,9 @@ public partial class AudioCollection : Node
|
|||
|
||||
[Export] public bool Shuffle = false;
|
||||
[Export] public double Timeout = 0;
|
||||
[Export] public bool RandomPitch;
|
||||
[Export] public float PitchStart;
|
||||
[Export] public float PitchEnd;
|
||||
|
||||
private State _state;
|
||||
|
||||
|
@ -66,6 +69,7 @@ public partial class AudioCollection : Node
|
|||
{
|
||||
case State.Ready:
|
||||
var player = GetChild<AudioStreamPlayer>(_currentChild);
|
||||
player.PitchScale = RandomPitch ? _rng.RandfRange(PitchStart, PitchEnd) : 1;
|
||||
player.Play();
|
||||
_state = State.Playing;
|
||||
_currentChild = Shuffle ? _rng.RandiRange(0, _count) : 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue