public RumbleHelper(XInputController controller, RumbleType rType)
        {
            input       = controller;
            rumbleType  = rType;
            rumbleState = 0;
            rumbleCount = 0;
            rumbleTimer = new DispatcherTimer();
            switch (rumbleType)
            {
            case RumbleType.wobbleRumble:
                rumbleTimer.Interval = new TimeSpan(0, 0, 0, 0, SHORT_RUMBLE_TIME);
                break;

            case RumbleType.burstRumble:
                rumbleTimer.Interval = new TimeSpan(0, 0, 0, 0, SHORT_RUMBLE_TIME);
                break;

            case RumbleType.shortRumble:
                rumbleTimer.Interval = new TimeSpan(0, 0, 0, 0, RUMBLE_TIME);
                break;

            case RumbleType.longRumble:
                rumbleTimer.Interval = new TimeSpan(0, 0, 0, 0, LONG_RUMBLE_TIME);
                break;
            }
            rumbleTimer.Tick           += new EventHandler(rumbleTimer_Tick);
            noVibration                 = new Vibration();
            noVibration.LeftMotorSpeed  = 0;
            noVibration.RightMotorSpeed = 0;
        }
Exemple #2
0
        public App()
        {
            instance = this;

            players        = 0;
            controllers    = new XInputController[4];
            controllers[0] = new XInputController(0);
            controllers[1] = new XInputController(1);
            controllers[2] = new XInputController(2);
            controllers[3] = new XInputController(3);

            xKeyboard = new XKeyboard();
        }
 public void setPlayer(int i, XInputController controller)
 {
     inGame           = false;
     readied          = false;
     this.controller  = controller;
     controlSource    = ControlSource.controller;
     connected        = controller.connected;
     name             = NameTextBox.Text;
     score            = 0;
     canAnswer        = false;
     lastAnswerResult = AnswerResult.no_answer;
     player           = i;
     setColor();
     readiedSound = new MediaPlayer();
 }
Exemple #4
0
        private void timer_Tick(object sender, EventArgs e)
        {
            if (App.getInstance() != null)
            {
                for (int i = 0; i < 4; i++)
                {
                    XInputController controller = App.getInstance().controllers[i];
                    PlayerControl    player     = MainWindow.getInstance().GetPlayerControl(i + 1);
                    controller.Update();
                    if (player.inGame)
                    {
                        if (controller.connected && !player.connected)
                        {
                            player.animateReconnected();
                        }
                        else if (!controller.connected && player.connected)
                        {
                            player.animateDisconnected();
                        }
                        else
                        {
                        }
                    }
                    else
                    {
                    }
                }

                MainWindow.getInstance().update();

                update();
            }
            else
            {
            }
        }