public void RepopulateHardware(IGamelogicEngine gle)
        {
            MappingConfig.Clear(false);
            MappingConfig.PopulateSwitches(gle.RequestedSwitches, this);
            MappingConfig.PopulateLamps(gle.RequestedLamps, this);
            MappingConfig.PopulateCoils(gle.RequestedCoils, this);
            MappingConfig.PopulateWires(gle.AvailableWires, this);

            // hook up plunger
            var plunger = GetComponentInChildren <PlungerComponent>();

            if (plunger)
            {
                const string description    = "Manual Plunger";
                var          plungerMapping = MappingConfig.Wires.FirstOrDefault(mc => mc.Description == description);
                if (plungerMapping == null)
                {
                    var mapping = new WireMapping().WithId();
                    mapping.Description           = description;
                    mapping.Source                = SwitchSource.InputSystem;
                    mapping.SourceInputActionMap  = InputConstants.MapCabinetSwitches;
                    mapping.SourceInputAction     = InputConstants.ActionPlunger;
                    mapping.DestinationDevice     = plunger;
                    mapping.DestinationDeviceItem = PlungerComponent.PullCoilId;
                    MappingConfig.AddWire(mapping);
                }
            }
        }
        public void Awake(IGamelogicEngine gamelogicEngine)
        {
            _gamelogicEngine = gamelogicEngine;
            _gamelogicEngine.OnDisplaysRequested += HandleDisplayRequested;
            _gamelogicEngine.OnDisplayFrame      += HandleFrameEvent;

            var dmds = Object.FindObjectsOfType <DisplayComponent>();

            foreach (var dmd in dmds)
            {
                Logger.Info($"[Player] Display \"{dmd.Id}\" connected.");
                _displayGameObjects[dmd.Id] = dmd;
            }
        }
Beispiel #3
0
        private void Awake()
        {
            var tableComponent  = gameObject.GetComponent <TableAuthoring>();
            var engineComponent = GetComponent <IGameEngineAuthoring>();

            Table         = tableComponent.CreateTable(tableComponent.Data);
            BallManager   = new BallManager(Table, TableToWorld);
            _inputManager = new InputManager();

            if (engineComponent != null)
            {
                GameEngine = engineComponent.GameEngine;
            }

            EngineProvider <IPhysicsEngine> .Set(physicsEngineId);

            EngineProvider <IPhysicsEngine> .Get().Init(tableComponent, BallManager);

            if (!string.IsNullOrEmpty(debugUiId))
            {
                EngineProvider <IDebugUI> .Set(debugUiId);
            }
        }
 public void Awake(TableComponent tableComponent, IGamelogicEngine gamelogicEngine, InputManager inputManager)
 {
     _tableComponent  = tableComponent;
     _gamelogicEngine = gamelogicEngine;
     _inputManager    = inputManager;
 }