Ejemplo n.º 1
0
        void SetupWind()
        {
            _windControllerList.Clear();
            var interfaceType      = typeof(IWindController);
            var windControlerTypes = AppDomain.CurrentDomain.GetAssemblies()
                                     .SelectMany(x => x.GetTypes())
                                     .Where(x => interfaceType.IsAssignableFrom(x) && !x.IsInterface && !x.IsAbstract)
                                     .Select(Activator.CreateInstance);

            foreach (var windControler in windControlerTypes)
            {
                IWindController windControllerInterface = (IWindController)windControler;
                if (windControllerInterface == null)
                {
                    continue;
                }

                string windControllerID = windControllerInterface.WindControlerID;
                WindControllerSettings windControllerSettings = GetWindControllerSettings(windControllerID);
                if (windControllerSettings == null)
                {
                    windControllerSettings = windControllerInterface.CreateDefaultSettings();
                    WindControllerSettingsList.Add(windControllerSettings);
                }
                else
                {
                    windControllerInterface.Settings = windControllerSettings;
                }

                _windControllerList.Add(windControllerInterface);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initialization of physics controllers
        /// </summary>
        private void InitializeControllers()
        {
            xCoordVoltageController = new VoltageController();
            yCoordVoltageController = new VoltageController();
            windController          = new WindController();
            trajectoryController    = new TrajectoryController();
            gameController          = new GameController(UpKeyboardButton, DownKeyboardButton, LeftKeyboardButton, RightKeyboardButton);

            controllers = new List <IController>();
            controllers.Add(xCoordVoltageController);
            controllers.Add(yCoordVoltageController);
            controllers.Add(windController);
            controllers.Add(trajectoryController);
            controllers.Add(gameController);
        }