com.puzzlescapegames.services 1.1.0 → 1.1.2

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.
@@ -62,15 +62,22 @@ namespace PuzzlescapeGames.Services
62
62
 
63
63
  public R GetAs< R >()
64
64
  where R : class, T =>
65
- Get<R>() as R;
66
-
65
+ Get< R >() as R;
66
+
67
67
  public T Get< R >()
68
68
  where R : T
69
69
  {
70
- if ( ContainsType< R >() ) return _registers.Where( x => x is R ).FirstOrDefault();
70
+ if ( ContainsType< R >() ) return _registers.FirstOrDefault( x => x is R );
71
71
 
72
72
  throw new Exception( $"REGISTRATOR DOESN'T CONTAINS {typeof(R)} ERROR" );
73
73
  }
74
+
75
+ public T Get( Type registr )
76
+ {
77
+ if ( ContainsType( registr ) ) return _registers.FirstOrDefault( x => x.GetType() == registr );
78
+
79
+ throw new Exception( $"REGISTRATOR DOESN'T CONTAINS {registr} ERROR" );
80
+ }
74
81
 
75
82
  public bool ContainsType< R >()
76
83
  where R : T =>
@@ -79,7 +86,7 @@ namespace PuzzlescapeGames.Services
79
86
  public bool ContainsType< R >( R registr )
80
87
  where R : T
81
88
  {
82
- return _registers.Any( ( x ) => x.GetType() == registr.GetType() );
89
+ return ContainsType( registr.GetType() );
83
90
  }
84
91
 
85
92
  public bool ContainsType( Type registr )
@@ -1,3 +1,5 @@
1
+ using System;
2
+
1
3
  namespace PuzzlescapeGames.Services.VibrationService
2
4
  {
3
5
  internal sealed class VibrationService : IVibrationService
@@ -15,5 +17,27 @@ namespace PuzzlescapeGames.Services.VibrationService
15
17
  Vibration.VibratePop();
16
18
  #endif
17
19
  }
20
+
21
+ public void VibrateIOS( ImpactFeedbackStyle style )
22
+ {
23
+ #if UNITY_EDITOR
24
+ return;
25
+ #endif
26
+ Vibration.VibrateIOS( style );
27
+ }
28
+
29
+ public void VibrateAndroid( VibrationType type )
30
+ {
31
+ #if UNITY_EDITOR
32
+ return;
33
+ #endif
34
+ switch(type)
35
+ {
36
+ case VibrationType.Pop: Vibration.VibratePop(); break;
37
+ case VibrationType.Peek: Vibration.VibratePeek(); break;
38
+ case VibrationType.Nope: Vibration.VibrateNope(); break;
39
+ default: throw new ArgumentOutOfRangeException( nameof(type), type, null );
40
+ }
41
+ }
18
42
  }
19
43
  }
@@ -0,0 +1,9 @@
1
+ namespace PuzzlescapeGames.Services.VibrationService
2
+ {
3
+ public enum VibrationType
4
+ {
5
+ Pop,
6
+ Peek,
7
+ Nope,
8
+ }
9
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: a68e10bc43f74ad8ae81a39c2791fadf
3
+ timeCreated: 1731901859
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.0",
4
+ "version" : "1.1.2",
5
5
  "author" : "Puzzlescape Games",
6
6
  "description" : "Common services.",
7
7
  "repository": {