示例#1
0
    protected override void Awake()
    {
        base.Awake();

        _inputMapper = new InputMapper(InputMapper.defaultKeyboardMap);
        _inputMapper.BindHoldEvent(InputMapper.MOVE_LEFT, _characterController.MoveLeft);
        _inputMapper.BindHoldEvent(InputMapper.MOVE_RIGHT, _characterController.MoveRight);
        _inputMapper.BindPressEvent(InputMapper.ACCELERATE, _characterController.EnterAcceleratingState);
        _inputMapper.BindReleaseEvent(InputMapper.ACCELERATE, _characterController.ExitAcceleratingState);
        _inputMapper.BindPressEvent(InputMapper.JUMP, _characterController.Jump);
        _inputMapper.BindPressEvent(InputMapper.DODGE, _characterController.Dodge);
        _inputMapper.BindPressEvent(InputMapper.ATTACK, _characterController.OnReceiveAttackCommand);
        _inputMapper.BindReleaseEvent(InputMapper.ATTACK, _characterController.OnFinishAttackCommand);
        _inputMapper.BindPressEvent(InputMapper.SWITCH_PREV, _characterController.SwitchPreviousIBSprite);
        _inputMapper.BindPressEvent(InputMapper.SWITCH_NEXT, _characterController.SwitchNextIBSprite);

        _inputMapper.isInControl = true;

        /*
         * _temperInputMapper = new InputMapper(InputMapper.defaultMacXboxOneMap);
         * _temperInputMapper.BindHoldEvent(InputMapper.MOVE_LEFT, _characterController.MoveLeft);
         * _temperInputMapper.BindHoldEvent(InputMapper.MOVE_RIGHT, _characterController.MoveRight);
         * _temperInputMapper.BindPressEvent(InputMapper.ACCELERATE, _characterController.EnterAcceleratingState);
         * _temperInputMapper.BindReleaseEvent(InputMapper.ACCELERATE, _characterController.ExitAcceleratingState);
         * _temperInputMapper.BindPressEvent(InputMapper.JUMP, _characterController.Jump);
         * _temperInputMapper.BindPressEvent(InputMapper.DODGE, _characterController.Dodge);
         * _temperInputMapper.BindPressEvent(InputMapper.ATTACK, _characterController.OnReceiveAttackCommand);
         * _temperInputMapper.BindReleaseEvent(InputMapper.ATTACK, _characterController.OnFinishAttackCommand);
         * _temperInputMapper.BindPressEvent(InputMapper.SWITCH_PREV, _characterController.SwitchPreviousIBSprite);
         * _temperInputMapper.BindPressEvent(InputMapper.SWITCH_NEXT, _characterController.SwitchNextIBSprite);
         *
         * _temperInputMapper.isInControl = true;
         */
    }
    private void Awake()
    {
        _audioSource            = gameObject.AddComponent <AudioSource>();
        _audioSource.spatialize = false;

        _textHolders[0] = questionTextHolder;
        _textHolders[1] = optionATextHolder;
        _textHolders[2] = optionBTextHolder;
        _textHolders[3] = optionCTextHolder;
        _textHolders[4] = optionDTextHolder;

        _inputMapper = new InputMapper();
        _inputMapper.BindPressEvent(InputMapper.SWITCH_UP, SwitchUp);
        _inputMapper.BindPressEvent(InputMapper.SWITCH_DOWN, SwitchDown);
        _inputMapper.BindHoldEvent(InputMapper.INTERACT, CheckExit);
        _inputMapper.BindReleaseEvent(InputMapper.INTERACT, ConfirmOrExit);
    }