Skip to content

Commit

Permalink
debug: Add span ball for switch s_spawn_ball.
Browse files Browse the repository at this point in the history
  • Loading branch information
freezy committed Jan 5, 2023
1 parent 479bc2f commit c616745
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,12 @@ public GamelogicEngineLamp[] RequestedLamps {

[NonSerialized] private Player _player;
[NonSerialized] private PinMame.PinMame _pinMame;
[NonSerialized] private BallManager _ballManager;
[NonSerialized] private PlayfieldComponent _playfieldComponent;

[SerializeReference] private PinMameGame _game;


private Dictionary<string, GamelogicEngineSwitch> _switches = new();
private Dictionary<int, string> _pinMameIdToSwitchIdMappings = new();
private Dictionary<string, int> _switchIdToPinMameIdMappings = new();
Expand Down Expand Up @@ -218,6 +222,8 @@ private void OnDestroy()
public void OnInit(Player player, TableApi tableApi, BallManager ballManager)
{
string vpmPath = null;
_ballManager = ballManager;
_playfieldComponent = GetComponentInChildren<PlayfieldComponent>();

#if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR
vpmPath = Path.Combine(Application.persistentDataPath, "pinmame");
Expand Down Expand Up @@ -712,6 +718,10 @@ public void Switch(string id, bool isClosed)
}
Logger.Info($"[PinMAME] => sw {id}: {isClosed} | {_switches[id].Description}");
_pinMame.SetSwitch(_switchIdToPinMameIdMappings[_switches[id].Id], isClosed);
} else if (id == "s_spawn_ball") {
if (isClosed) {
_ballManager.CreateBall(new DebugBallCreator(630, _playfieldComponent.Height / 2f, _playfieldComponent.TableHeight));
}
} else {
Logger.Error($"[PinMAME] Unknown switch \"{id}\".");
}
Expand Down

0 comments on commit c616745

Please sign in to comment.