示例#1
0
    /* Controller Handler */
    private void OnInput(IExtendedHeroesController inputs, int port)
    {
        // Only process inputs ingame.
        if (port != _port)
        {
            return;
        }

        if (!_heroesController.IsInMenu() && Window.IsAnyWindowActivated())
        {
            // Toggle Freeze On/Off
            if (ButtonPressed(inputs.ButtonFlags, ButtonFlags.TeamBlast) && ButtonPressed(inputs.OneFramePressButtonFlag, ButtonFlags.Jump))
            {
                if (_heroesController.IsGameFrozen)
                {
                    _heroesController.UnFreezeGame();
                }
                else
                {
                    _heroesController.FreezeGame();
                }
            }

            // Toggle Camera On/Off
            if (ButtonPressed(inputs.ButtonFlags, ButtonFlags.TeamBlast) && ButtonPressed(inputs.OneFramePressButtonFlag, ButtonFlags.FormationR))
            {
                if (_heroesController.IsCameraEnabled)
                {
                    _heroesController.FreezeCamera();
                }
                else
                {
                    _heroesController.UnFreezeCamera();
                }
            }

            // Process Remaining Inputs
            if (!_heroesController.IsCameraEnabled && !_heroesController.IsPaused())
            {
                HandleFreeMode(ref inputs);
            }
        }
    }