예제 #1
0
        public PlayerController(Data data, InputModel inputModel,
                                PlayerModel playerModel, PauseModel pauseModel)
        {
            _controllerList = new ControllerList();

            var cameraFactory = new CameraFactory(data.CameraData);
            var laserFactory  = new LaserFactory();

            var cameraModel = new CameraModel(cameraFactory);

            var moveController = new MoveController(inputModel.GetInputKeyboard(),
                                                    data.PlayerData, playerModel.Transform);

            var shootController = new ShootController(data.BulletData, playerModel, laserFactory);

            var cameraController = new CameraController(cameraModel, playerModel,
                                                        data.CameraData, pauseModel);

            var explosion = new Explosion(data.ExplosionData, playerModel);

            var abilityController = new AbilityController(inputModel, explosion);

            _controllerList.Add(moveController).Add(shootController).
            Add(cameraController).Add(abilityController).Initialize();
        }
예제 #2
0
        private void Start()
        {
            _controllerList = new ControllerList();

            var asteroidFactory = new AsteroidFactory();
            var playerFactory   = new PlayerFactory(_data.PlayerData);

            var playerModel = new PlayerModel(playerFactory);
            var inputModel  = new InputModel();
            var pointModel  = new PointModel();
            var pauseModel  = new PauseModel();

            var enemyPool = new EnemyPool(
                _data.EnemyData.AsteroidPoolSize, _data.EnemyData,
                asteroidFactory);

            _controllerList.Add(new InputController(
                                    inputModel.GetInputKeyboard(), inputModel.GetInputMouse(),
                                    inputModel.Pause(), inputModel.Ability()));

            _controllerList.Add(new PlayerController(
                                    _data, inputModel,
                                    playerModel, pauseModel));

            _controllerList.Add(new AsteroidController(
                                    _data.EnemyData, playerModel,
                                    pointModel, asteroidFactory,
                                    enemyPool));

            _controllerList.Add(new UIController(
                                    inputModel, pointModel,
                                    enemyPool, pauseModel));

            _controllerList.Add(new PauseController(
                                    pauseModel));

            _controllerList.Initialize();
        }