com.puzzlescapegames.services 1.1.9 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -59,6 +59,12 @@ namespace PuzzlescapeGames.Services.AudioService
59
59
  IsPlaying = false;
60
60
  Source.clip = null;
61
61
  }
62
+
63
+ public void Rewind()
64
+ {
65
+ Source.time = 0;
66
+ Source.Stop();
67
+ }
62
68
 
63
69
  public Tween DoVolume( float target, float duration )
64
70
  {
@@ -87,7 +93,7 @@ namespace PuzzlescapeGames.Services.AudioService
87
93
  isLoop = trigger;
88
94
  Source.loop = trigger;
89
95
  }
90
-
96
+
91
97
  private void StartPlayDelay( float playTime )
92
98
  {
93
99
  PlayDelay( playTime ).Forget();
@@ -20,7 +20,7 @@ namespace PuzzlescapeGames.Services.AudioService
20
20
  Audio.PlayLoop( clip );
21
21
  }
22
22
 
23
- public void ChangedMusic( AudioClip clip, float fadeOut = 0.33f, float fadeIn = 0.33f )
23
+ public void Changed( AudioClip clip, float fadeOut = 0.33f, float fadeIn = 0.33f )
24
24
  {
25
25
  _fade?.Kill();
26
26
 
@@ -44,22 +44,22 @@ namespace PuzzlescapeGames.Services.AudioService
44
44
  }
45
45
  }
46
46
 
47
- public void SetMusicVolume( float value )
47
+ public void SetVolume( float value )
48
48
  {
49
49
  Audio.Source.volume = value;
50
50
  }
51
51
 
52
- public Tween DoMusicVolume( float target, float duration )
52
+ public Tween DoVolume( float target, float duration )
53
53
  {
54
54
  return Audio.DoVolume( target, duration );
55
55
  }
56
56
 
57
- public void PauseMusic( bool trigger )
57
+ public void Pause( bool trigger )
58
58
  {
59
59
  Audio.Pause( trigger );
60
60
  }
61
61
 
62
- public void MuteMusic( bool trigger )
62
+ public void Mute( bool trigger )
63
63
  {
64
64
  Audio.Mute( trigger );
65
65
  }
@@ -7,14 +7,16 @@ namespace PuzzlescapeGames.Services.TickableService
7
7
  {
8
8
  public sealed class TickableService
9
9
  {
10
+ public event Action OnMinutesTick;
10
11
  public event Action OnSecondsTick;
11
12
 
12
13
  public TickableService()
13
14
  {
14
15
  SecondsTick( ThreadingUtils.QuitToken ).Forget();
16
+ MinutesTick( ThreadingUtils.QuitToken ).Forget();
15
17
  }
16
18
 
17
- private async UniTask SecondsTick( CancellationToken token )
19
+ private async UniTask SecondsTick( CancellationToken token = default )
18
20
  {
19
21
  bool isCanceled = false;
20
22
 
@@ -25,5 +27,17 @@ namespace PuzzlescapeGames.Services.TickableService
25
27
  isCanceled = await UniTask.WaitForSeconds( 1f, cancellationToken: token ).SuppressCancellationThrow();
26
28
  }
27
29
  }
30
+
31
+ private async UniTask MinutesTick( CancellationToken token = default )
32
+ {
33
+ bool isCanceled = false;
34
+
35
+ while ( !isCanceled )
36
+ {
37
+ OnMinutesTick?.Invoke();
38
+
39
+ isCanceled = await UniTask.WaitForSeconds( 60f, cancellationToken: token ).SuppressCancellationThrow();
40
+ }
41
+ }
28
42
  }
29
43
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name" : "com.puzzlescapegames.services",
3
3
  "displayName" : "Puzzlescape Games Services",
4
- "version" : "1.1.9",
4
+ "version" : "1.2.1",
5
5
  "author" : "Puzzlescape Games",
6
6
  "description" : "Common services.",
7
7
  "repository": {