Beispiel #1
0
    private void PollForButtonInput()
    {
        if (Input.GetButtonDown("Start"))
        {
            //TODO: this is where we can go to reset the game or maybe even close it out and go back to the app selection screen
        }
        if (Input.GetKeyDown(JoystickButtonMaps.left.ToString()) || Input.GetKeyDown(JoystickButtonMaps.a.ToString()))
        {
            //TODO: set up the move cursor to the left
            print("BACK");
            circuitGridControlScript.MoveCursor(JoystickButtonMaps.left);
        }
        if (Input.GetKeyDown(JoystickButtonMaps.right.ToString()) || Input.GetKeyDown(JoystickButtonMaps.d.ToString()))
        {
            //TODO: setup the move cursor to the right
            print("FORWARD");
            circuitGridControlScript.MoveCursor(JoystickButtonMaps.right);
        }

        ArcadeButtonGates gateButtonPressed = arcadeButtonInput.isButtonPressed();

        if (gateButtonPressed != ArcadeButtonGates.None)
        {
            // print("what is gate buton " + gateButtonPressed);
            PressedGate(gateButtonPressed);
        }

        if (Input.GetKey("escape"))
        {
            Application.Quit();
        }
    }
Beispiel #2
0
    private void PollForButtonInput()
    {
        if (Input.GetButtonDown("Start"))
        {
            //the game or maybe even close it out and go back to the app selection screen
            startButtonPressCount = Time.time;
            print("Start button press " + startButtonPressCount);
        }
        if (Input.GetButtonDown("Menu"))
        {
            print("QUIT APP!!");
            System.Diagnostics.Process.Start("osascript", "-e 'tell application \"Quantum Arcade\" to activate'");
            Application.Quit();
        }

        if (Input.GetKeyDown(JoystickButtonMaps.left.ToString()) || Input.GetKeyDown(JoystickButtonMaps.a.ToString()))
        {
            //TODO: set up the move cursor to the left
            //print("BACK");
            circuitGridControlScript.MoveCursor(JoystickButtonMaps.left);
        }
        if (Input.GetKeyDown(JoystickButtonMaps.right.ToString()) || Input.GetKeyDown(JoystickButtonMaps.d.ToString()))
        {
            //TODO: setup the move cursor to the right
            //print("FORWARD");
            circuitGridControlScript.MoveCursor(JoystickButtonMaps.right);
        }


        ArcadeButtonGates gateButtonPressed = arcadeButtonInput.isButtonPressed();

        if (gateButtonPressed != ArcadeButtonGates.None)
        {
            // print("what is gate buton " + gateButtonPressed);
            PressedGate(gateButtonPressed);
        }

        if (Input.GetButtonUp("Start"))
        {
            startButtonPressCount = Math.Abs(Time.time - startButtonPressCount);

            print("time down " + startButtonPressCount);

            if (startButtonPressCount >= 3.0f)
            {
                print("QUIT APP!!");
                startButtonPressCount = 0f;

                System.Diagnostics.Process.Start("osascript", "-e 'tell application \"AppMenu\" to activate'");
                Application.Quit();
            }
            startButtonPressCount = 0f;
        }
        if (Input.GetKey("escape"))
        {
            Application.Quit();
        }
    }
    public void ButtonPressed(ArcadeButtonGates gate)
    {
        //we have to know which button was pressed, so use the Gate Enums
        //public enum ArcadeButtonGates { None, iz, zi, ih, hi, ix, xi, cz };

        string gateName  = gate.ToString();
        string urlString = API_URL + "pressed?gate=" + gateName;

        // print("reaching out to tell the arcacde controls to go " + urlString);
        StartCoroutine(GetRequest(urlString));
    }
Beispiel #4
0
    public void PressedGate(ArcadeButtonGates gateName)
    {
        //NOTE: my next step is to implement this
        //arcadeButtonController.ButtonPressed(gateName);
        switch (gateName)
        {
        case ArcadeButtonGates.xi:
            print("XI");
            circuitGridControlScript.AddGate(gateName);
            break;

        case ArcadeButtonGates.hi:
            print("HI");
            circuitGridControlScript.AddGate(gateName);
            break;

        default:
            print("we no use these yet");
            break;
        }
    }
Beispiel #5
0
    public void PressedGate(ArcadeButtonGates gateName)
    {
        //NOTE: animate when the button is pressed
        arcadeAPIController.ButtonPressed(gateName);
        switch (gateName)
        {
        case ArcadeButtonGates.xi:
            print("XI");
            circuitGridControlScript.AddGate(gateName);
            break;

        case ArcadeButtonGates.hi:
            print("HI");
            circuitGridControlScript.AddGate(gateName);
            break;

        default:
            print("we no use these yet");
            break;
        }
    }
    public void AddGate(ArcadeButtonGates gate)
    {
        // Extract column number and row number from name
        var index = Regex.Matches(selectedGate.name, @"\d+").OfType <Match>().Select(m => int.Parse(m.Value)).ToArray();

        selectedColNum = index[0];
        selectedRowNum = index[1];

        selectedIndex             = selectedColNum * circuitDepth + selectedRowNum;
        selectedGate              = GameObject.Find("gate[" + selectedColNum + "][" + selectedRowNum + "]");
        cursor.transform.position = selectedGate.transform.position;

        if (gate == ArcadeButtonGates.xi)
        {
            updateCircuit = true;
            if (gateArray[selectedIndex] == "X")
            {
                gateArray[selectedIndex] = "I";
            }
            else
            {
                gateArray[selectedIndex] = "X";
            }
        }
        if (gate == ArcadeButtonGates.hi)
        {
            updateCircuit = true;
            if (gateArray[selectedIndex] == "H")
            {
                gateArray[selectedIndex] = "I";
            }
            else
            {
                gateArray[selectedIndex] = "H";
            }
        }
        UpdateCircuit();
    }