예제 #1
0
    void CheckKeyPressed()
    {
        if (Input.GetButtonDown("Start"))
        {
            // Done. Save score and back to main menu
            GameController.Instance.player.StoreNewHighScore(hud.UserName());
            GameController.Instance.LoadMainMenu();
        }

        float hVvalue = Input.GetAxis("Horizontal");
        float vValue  = Input.GetAxis("Vertical");

        if (hVvalue == 0 && vValue == 0)
        {
            joystickReleased = true;
            return;
        }

        if (!joystickReleased)
        {
            return;
        }

        // Check horizontal movement
        if (hVvalue > 0f)
        {
            // Select next initial
            selectedInitial += 1;
            selectedInitial  = (3 + selectedInitial) % 3;
        }
        else if (hVvalue < 0f)
        {
            // Select previous initial
            selectedInitial -= 1;
            selectedInitial  = (3 + selectedInitial) % 3;
        }

        // Check vertical movement
        if (vValue > 0f)
        {
            // Next letter
            hud.ChangeInitial(selectedInitial, +1);
        }
        else if (vValue < 0f)
        {
            // Previous letter
            hud.ChangeInitial(selectedInitial, -1);
        }
        joystickReleased = false;
    }
예제 #2
0
    void CheckKeyPressed()
    {
        if (Input.GetButtonDown("Start"))
        {
            // Done. Save score and back to main menu
            GameController.Instance.player.StoreNewHighScore(hud.UserName());
            GameController.Instance.LoadMainMenu();
        }
        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()))
        {
            // Select previous initial
            selectedInitial -= 1;
            selectedInitial  = (3 + selectedInitial) % 3;
        }
        if (Input.GetKeyDown(JoystickButtonMaps.right.ToString()) || Input.GetKeyDown(JoystickButtonMaps.d.ToString()))
        {
            selectedInitial += 1;
            selectedInitial  = (3 + selectedInitial) % 3;
        }
        if (Input.GetKeyDown(JoystickButtonMaps.up.ToString()) || Input.GetKeyDown(JoystickButtonMaps.w.ToString()))
        {
            // Previous letter
            hud.ChangeInitial(selectedInitial, -1);
        }
        if (Input.GetKeyDown(JoystickButtonMaps.down.ToString()) || Input.GetKeyDown(JoystickButtonMaps.z.ToString()))
        {
            // Next letter
            hud.ChangeInitial(selectedInitial, +1);
        }
    }