Exemplo n.º 1
0
 /// <summary>
 /// Inits the handler and adds it to the AllInputHandlers dictionary.
 /// </summary>
 /// <param name="handler">Handler to init</param>
 public void InitNewInputHandler(IInputHandler handler)
 {
     if (!AllInputHandlers.ContainsKey(handler.Name))
     {
         handler.Init();
         AllInputHandlers.Add(handler.Name, handler);
     }
 }
Exemplo n.º 2
0
        public void Awake()
        {
            //_generateTestCase.Run();

            _mazeResults = _currentMazeHolder.Results;
            _cameraManagement.Init(CameraTransform, Camera, _mazeResults.MazeJumper);
            _inputHandler.Init(_cameraManagement, new InputHandlerOptions
            {
                MoveDown = () => {
                    if (_currentLevel > 0)
                    {
                        _currentLevel -= 1;
                        BuildUi();
                    }
                },
                MoveUp = () => {
                    if (_currentLevel < _mazeResults.MazeJumper.Size.Z - 1)
                    {
                        _currentLevel += 1;
                        BuildUi();
                    }
                },
                ToggleDeadEnds = () => {
                    if (_uiModeSwitcher.Mode != UiMode.Agent)
                    {
                        _modelStateHelper.SetNextModelState(_mazeResults.MazeJumper);
                        BuildUi();
                    }
                },
                ReturnToMazeLoading = needsRegenerating =>
                {
                    _mazeNeedsGenerating.Generate = needsRegenerating;
                    _sceneLoader.LoadMazeLoader();
                },
                ToggleUI = () =>
                {
                    TrySwitch();
                }
            });

            BuildUi();
        }