Exemplo n.º 1
0
    /// <summary> Selected input conroller on start game or in runtime </summary>
    /// /// <param name="type"> New input type </param>
    public void SetController(InputType type)
    {
        if (CurrentController != null)
        {
            CurrentController.DeselectInput();
        }
        switch (type)
        {
        case InputType.KeyboardAndMouse: CurrentController = KeyBoardAndMouseInput; break;

        case InputType.GamePad: CurrentController = GamePadInput; break;

        case InputType.TouchScreen: CurrentController = TouchScreenInput; break;
        }

        InputType = type;
        PlayerProfile.InputType = InputType;

        CurrentController.SelectInput(this);

        if (SelectedCharacter != null)
        {
            SelectedCharacter.SetInput(CurrentController);
        }
    }