Пример #1
0
 public ButtonEndCondition()
 {
     Button = Button.LeftMouse;
     lastMouse = new MouseState();
     lastRemote = new WiimoteState();
     lastBalance = new BalanceBoardState();
 }
Пример #2
0
 public ButtonEndCondition(ButtonEndCondition ec)
 {
     Button = ec.Button;
     lastMouse = new MouseState();
     lastRemote = new WiimoteState();
     lastBalance = new BalanceBoardState();
 }
Пример #3
0
        private static void setupPointers(int num)
        {
            remoteConnected = false;
            nunchuckConnected = false;
            balanceConnected = false;
            remoteState = new WiimoteState();
            nunchuckState = new NunchuckState();
            balanceState = new BalanceBoardState();

            wiimote_t[] wms = MarshalWiimotes();
            for (int i = 0; i < num; i++)
            {
                if (wms[i].exp.type == WiiExpansion.EXP_NONE || wms[i].exp.type == WiiExpansion.EXP_NUNCHUK)
                {
                    remoteConnected = true;
                    remoteIdx = i;
                    remoteState.connected = true;
                }

                if (wms[i].exp.type == WiiExpansion.EXP_NUNCHUK)
                {
                    nunchuckConnected = true;
                    nunchuckIdx = i;
                    nunchuckState.connected = true;
                }
                if (wms[i].exp.type == WiiExpansion.EXP_BALANCE)
                {
                    balanceConnected = true;
                    balanceIdx = i;
                    balanceState.connected = true;
                }
            }
        }
Пример #4
0
        public override bool isMet(GameTime gameTime, Region r, Vector3 pos)
        {
            MouseState mouse = Mouse.GetState();
            WiimoteState remote = WiiUse.GetRemoteState();
            BalanceBoardState balance = WiiUse.GetBalanceBoardState();
            bool rv = false;

            switch (Button)
            {
                case Button.LeftMouse:
                    rv = mouse.LeftButton == ButtonState.Pressed
                        && lastMouse.LeftButton == ButtonState.Released;
                    break;
                case Button.RightMouse:
                    rv = mouse.RightButton == ButtonState.Pressed
                        && lastMouse.RightButton == ButtonState.Released;
                    break;
                case Button.A:
                    rv = remote.a == ButtonState.Pressed
                        && lastRemote.a == ButtonState.Released;
                    break;
                case Button.B:
                    rv = remote.b == ButtonState.Pressed
                        && lastRemote.b == ButtonState.Released;
                    break;
                case Button.Up:
                    rv = remote.dUp == ButtonState.Pressed
                        && lastRemote.dUp == ButtonState.Released;
                    break;
                case Button.Down:
                    rv = remote.dDown == ButtonState.Pressed
                        && lastRemote.dDown == ButtonState.Released;
                    break;
                case Button.Left:
                    rv = remote.dLeft == ButtonState.Pressed
                        && lastRemote.dLeft == ButtonState.Released;
                    break;
                case Button.Right:
                    rv = remote.dRight == ButtonState.Pressed
                        && lastRemote.dRight == ButtonState.Released;
                    break;
                case Button.One:
                    rv = remote.one == ButtonState.Pressed
                        && lastRemote.one == ButtonState.Released;
                    break;
                case Button.Two:
                    rv = remote.two == ButtonState.Pressed
                        && lastRemote.two == ButtonState.Released;
                    break;
                case Button.Home:
                    rv = remote.home == ButtonState.Pressed
                        && lastRemote.home == ButtonState.Released;
                    break;
                case Button.Plus:
                    rv = remote.plus == ButtonState.Pressed
                        && lastRemote.plus == ButtonState.Released;
                    break;
                case Button.Minus:
                    rv = remote.minus == ButtonState.Pressed
                        && lastRemote.minus == ButtonState.Released;
                    break;
                case Button.BalanceBoardButton:
                    rv = balance.button == ButtonState.Pressed
                        && lastBalance.button == ButtonState.Released;
                    break;
                default:
                    rv = false;
                    break;
            }
            lastMouse = mouse;
            lastRemote = remote;
            lastBalance = balance;

            return rv;
        }