Exemplo n.º 1
0
    bool IsPressed(eBtn btn, ref bool isJump)
    {
        eBtn pressedBtn = eBtn.None;

        if (Input.GetKey("a") || Input.GetKey("left"))
        {
            pressedBtn = eBtn.BtnA;
        }
        else if (Input.GetKey("s") || Input.GetKey("down"))
        {
            pressedBtn = eBtn.BtnS;
        }
        else if (Input.GetKey("d") || Input.GetKey("right"))
        {
            pressedBtn = eBtn.BtnD;
        }
        else if (Input.GetKey("w") || Input.GetKey("up"))
        {
            pressedBtn = eBtn.BtnW;
        }
        if (Input.GetKey("space"))
        {
            isJump = true;
        }

        return(btn == pressedBtn);
    }
        public void setBtn(eBtn btn, eBtnState state)
        {
            Debug.WriteLine("GPIO -> " + btn + " " + state);
            GpioPinValue v = state == eBtnState.PRESSED ? BTN_PRESSED_VALUE : BTN_UNPRESSED_VALUE;

            foreach (GpioPin rPin in m_rBtnToPinsMapping[btn])
            {
                rPin.Write(v);
            }
        }