@@ -101,8 +101,12 @@ public GamelogicEngineLamp[] RequestedLamps {
101
101
102
102
[ NonSerialized ] private Player _player ;
103
103
[ NonSerialized ] private PinMame . PinMame _pinMame ;
104
+ [ NonSerialized ] private BallManager _ballManager ;
105
+ [ NonSerialized ] private PlayfieldComponent _playfieldComponent ;
106
+
104
107
[ SerializeReference ] private PinMameGame _game ;
105
108
109
+
106
110
private Dictionary < string , GamelogicEngineSwitch > _switches = new ( ) ;
107
111
private Dictionary < int , string > _pinMameIdToSwitchIdMappings = new ( ) ;
108
112
private Dictionary < string , int > _switchIdToPinMameIdMappings = new ( ) ;
@@ -218,6 +222,8 @@ private void OnDestroy()
218
222
public void OnInit ( Player player , TableApi tableApi , BallManager ballManager )
219
223
{
220
224
string vpmPath = null ;
225
+ _ballManager = ballManager ;
226
+ _playfieldComponent = GetComponentInChildren < PlayfieldComponent > ( ) ;
221
227
222
228
#if ( UNITY_IOS || UNITY_ANDROID ) && ! UNITY_EDITOR
223
229
vpmPath = Path . Combine ( Application . persistentDataPath , "pinmame" ) ;
@@ -712,6 +718,10 @@ public void Switch(string id, bool isClosed)
712
718
}
713
719
Logger . Info ( $ "[PinMAME] => sw { id } : { isClosed } | { _switches [ id ] . Description } ") ;
714
720
_pinMame . SetSwitch ( _switchIdToPinMameIdMappings [ _switches [ id ] . Id ] , isClosed ) ;
721
+ } else if ( id == "s_spawn_ball" ) {
722
+ if ( isClosed ) {
723
+ _ballManager . CreateBall ( new DebugBallCreator ( 630 , _playfieldComponent . Height / 2f , _playfieldComponent . TableHeight ) ) ;
724
+ }
715
725
} else {
716
726
Logger . Error ( $ "[PinMAME] Unknown switch \" { id } \" .") ;
717
727
}
0 commit comments