Exemplo n.º 1
0
 protected override void OnCreate()
 {
     _visualPinballSimulationSystemGroup = World.GetOrCreateSystem <VisualPinballSimulationSystemGroup>();
     _simulateCycleSystemGroup           = World.GetOrCreateSystem <SimulateCycleSystemGroup>();
     _collDataEntityQuery = EntityManager.CreateEntityQuery(typeof(ColliderData));
     _eventQueue          = new NativeQueue <EventData>(Allocator.Persistent);
 }
        protected override void OnCreate()
        {
            _flipperDataQuery        = EntityManager.CreateEntityQuery(ComponentType.ReadOnly <FlipperMovementData>(), ComponentType.ReadOnly <FlipperStaticData>());
            _collisionEventDataQuery = EntityManager.CreateEntityQuery(ComponentType.ReadOnly <CollisionEventData>());

            _simulationSystemGroup    = World.GetExistingSystem <VisualPinballSimulationSystemGroup>();
            _staticBroadPhaseSystem   = World.GetOrCreateSystem <StaticBroadPhaseSystem>();
            _dynamicBroadPhaseSystem  = World.GetOrCreateSystem <DynamicBroadPhaseSystem>();
            _staticNarrowPhaseSystem  = World.GetOrCreateSystem <StaticNarrowPhaseSystem>();
            _dynamicNarrowPhaseSystem = World.GetOrCreateSystem <DynamicNarrowPhaseSystem>();
            _displacementSystemGroup  = World.GetOrCreateSystem <UpdateDisplacementSystemGroup>();
            _staticCollisionSystem    = World.GetOrCreateSystem <StaticCollisionSystem>();
            _dynamicCollisionSystem   = World.GetOrCreateSystem <DynamicCollisionSystem>();
            _contactSystem            = World.GetOrCreateSystem <ContactSystem>();
            _ballSpinHackSystem       = World.GetOrCreateSystem <BallSpinHackSystem>();
            _systemsToUpdate.Add(_staticBroadPhaseSystem);
            _systemsToUpdate.Add(_dynamicBroadPhaseSystem);
            _systemsToUpdate.Add(_staticNarrowPhaseSystem);
            _systemsToUpdate.Add(_dynamicNarrowPhaseSystem);
            _systemsToUpdate.Add(_displacementSystemGroup);
            _systemsToUpdate.Add(_staticCollisionSystem);
            _systemsToUpdate.Add(_dynamicCollisionSystem);
            _systemsToUpdate.Add(_contactSystem);
            _systemsToUpdate.Add(_ballSpinHackSystem);

            Contacts = new NativeList <ContactBufferElement>(Allocator.Persistent);
        }
Exemplo n.º 3
0
        public void Init(TableComponent tableComponent, BallManager ballManager)
        {
            _ballManager      = ballManager;
            _entityManager    = World.DefaultGameObjectInjectionWorld.EntityManager;
            _flipperDataQuery = _entityManager.CreateEntityQuery(
                ComponentType.ReadOnly <FlipperMovementData>(),
                ComponentType.ReadOnly <FlipperStaticData>(),
                ComponentType.ReadOnly <SolenoidStateData>()
                );

            _ballDataQuery = _entityManager.CreateEntityQuery(ComponentType.ReadOnly <BallData>());

            _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

            var transform = tableComponent.gameObject.transform;

            _worldToLocal = transform.worldToLocalMatrix;
        }
Exemplo n.º 4
0
 protected override void OnCreate()
 {
     _player = Object.FindObjectOfType <Player>();
     _visualPinballSimulationSystemGroup = World.GetOrCreateSystem <VisualPinballSimulationSystemGroup>();
     _eventQueue = new NativeQueue <EventData>(Allocator.Persistent);
 }
Exemplo n.º 5
0
 internal TeleporterApi(GameObject go, Player player)
 {
     _component             = go.GetComponentInChildren <TeleporterComponent>();
     _player                = player;
     _simulationSystemGroup = World.DefaultGameObjectInjectionWorld.GetOrCreateSystem <VisualPinballSimulationSystemGroup>();
 }