public void Init(TableAuthoring tableAuthoring)
        {
            _entityManager    = World.DefaultGameObjectInjectionWorld.EntityManager;
            _flipperDataQuery = _entityManager.CreateEntityQuery(
                ComponentType.ReadOnly <FlipperMovementData>(),
                ComponentType.ReadOnly <FlipperStaticData>(),
                ComponentType.ReadOnly <SolenoidStateData>()
                );

            _ballManager   = BallManager.Instance(tableAuthoring.Table, tableAuthoring.gameObject.transform.localToWorldMatrix);
            _ballDataQuery = _entityManager.CreateEntityQuery(ComponentType.ReadOnly <BallData>());

            var visualPinballSimulationSystemGroup = _entityManager.World.GetOrCreateSystem <VisualPinballSimulationSystemGroup>();
            var simulateCycleSystemGroup           = _entityManager.World.GetOrCreateSystem <SimulateCycleSystemGroup>();

            visualPinballSimulationSystemGroup.Enabled = true;
            simulateCycleSystemGroup.PhysicsEngine     = this;         // needed for flipper status update we don't do in all engines

            _worldToLocal = tableAuthoring.gameObject.transform.worldToLocalMatrix;
        }
Esempio n. 2
0
 void IApiInitializable.OnInit()
 {
     _ballManager = BallManager.Instance(Player.Table, Player.TableToWorld);
     Init?.Invoke(this, EventArgs.Empty);
 }