Ejemplo n.º 1
0
        private void Start()
        {
            _context = new GameContext();

            var playerFactory      = new PlayerFactory(_data.PlayerData);
            var saveDataRepository = new SaveDataRepository();

            var inputModel    = new InputModel();
            var playerModel   = new PlayerModel(playerFactory);
            var taskModel     = new TaskModel(_taskRoot);
            var interactModel = new InteractModel();

            _controllers = new Controllers();

            var playerCamera = playerModel.GetCamera();

            _controllers.Add(new InputController(inputModel.GetInputKeyboard(), inputModel.GetInputMouse(),
                                                 inputModel.GetInputInteract(), inputModel.GetInputSave(), inputModel.GetInputLoad(), inputModel.GetInputMap()));
            _controllers.Add(new MoveController(inputModel.GetInputKeyboard(), interactModel.GetInteractionSwitch(),
                                                playerModel.GetCharacterController(), playerModel.GetTransform(), playerModel.GetAnimator(),
                                                _data.PlayerData));
            _controllers.Add(new TaskController(taskModel, _data.TaskData, _context));
            _controllers.Add(new CameraController(inputModel.GetInputMouse(), interactModel.GetInteractionSwitch(),
                                                  playerModel.GetCharacterController().transform,
                                                  _data.PlayerData, playerCamera.transform));
            _controllers.Add(new InteractController(inputModel.GetInputInteract(), interactModel.GetInteractionSwitch(),
                                                    playerCamera.transform, _context.CrosshairView));
            _controllers.Add(new CursorController(interactModel.GetInteractionSwitch()));
            _controllers.Add(new SaveController(inputModel.GetInputLoad(), inputModel.GetInputSave(),
                                                saveDataRepository, playerFactory, playerCamera.transform, taskModel));
            _controllers.Add(new MinimapController(_context.MinimapView, playerFactory.GetTransform(), inputModel.GetInputMap()));

            _controllers.Initialization();
        }
Ejemplo n.º 2
0
        public SaveController(IInputKeyPressable load, IInputKeyPressable save,
                              SaveDataRepository saveDataRepository, IPlayerFactory playerFactory, Transform cameraTransform, TaskModel taskModel)
        {
            _taskModel          = taskModel;
            _saveDataRepository = saveDataRepository;
            _playerFactory      = playerFactory;
            _cameraTransform    = cameraTransform;
            _load  = load;
            _save  = save;
            _tasks = taskModel.GetTasks();

            _load.OnKeyPressed += LoadGame;
            _save.OnKeyPressed += SaveGame;
        }