using Godot; using System.Collections.Generic; using System.Text; namespace Rokojori { [GlobalClass,Tool] public partial class AudioManager:Node { [Export] public float bufferCutLength = 0.021f; Dictionary _lastPlayTime = new Dictionary(); public float GetLastPlayed( SelectorFlag selectorFlag ) { if ( ! _lastPlayTime.ContainsKey( selectorFlag ) ) { return -1; } return _lastPlayTime[ selectorFlag ]; } public void RecordSoundPlaying( SelectorFlag selectorFlag ) { _lastPlayTime[ selectorFlag ] = TimeLine.osTime; } public bool CanPlay( SelectorFlag selectorFlag, float blockDuration ) { if ( ! _lastPlayTime.ContainsKey( selectorFlag ) ) { return true; } return ( TimeLine.osTime - _lastPlayTime[ selectorFlag ] ) > blockDuration; } } }