public void OnInit(Player player, TableApi tableApi, BallManager ballManager) { _player = player; _ballManager = ballManager; OnDisplaysRequested?.Invoke(this, new RequestedDisplays(new DisplayConfig(DisplayDmd, DmdWidth, DmdHeight))); // debug print stuff OnCoilChanged += DebugPrintCoil; // eject ball onto playfield OnCoilChanged?.Invoke(this, new CoilEventArgs(CoilTroughEject, true)); _player.ScheduleAction(100, () => OnCoilChanged?.Invoke(this, new CoilEventArgs(CoilTroughEject, false))); _playfieldComponent = GetComponentInChildren <PlayfieldComponent>(); OnStarted?.Invoke(this, EventArgs.Empty); }
private void Awake() { _playfield = GetComponentInChildren <PlayfieldComponent>(); var playfieldTransform = _playfield.transform; _ltw = playfieldTransform.localToWorldMatrix; _wtl = playfieldTransform.worldToLocalMatrix; var z = _playfield.PlayfieldHeight; var p1 = _ltw.MultiplyPoint(new Vector3(-100f, 100f, z)); var p2 = _ltw.MultiplyPoint(new Vector3(100f, 100f, z)); var p3 = _ltw.MultiplyPoint(new Vector3(100f, -100f, z)); _playfieldPlane.Set3Points(p1, p2, p3); _entityManager = World.DefaultGameObjectInjectionWorld.EntityManager; _ballEntityQuery = _entityManager.CreateEntityQuery(typeof(BallData)); }