コード例 #1
0
    void Start()
    {
        source.clip = clip;

        accio = ACCIO_DE_MENU.PLAY_GAME;
        timer = 1f;
        playGameSprite.enabled = true;
        exitGameSprite.enabled = false;
    }
コード例 #2
0
    void FixedUpdate()
    {
        inputDirection.y = (-1) * Input.GetAxis("P1_LeftJoystickVertical");

        timer += Time.deltaTime;

        if (inputDirection.y > 0.7f && timer > 0.3f)
        {
            timer = 0f;
            if (accio == ACCIO_DE_MENU.EXIT)
            {
                accio = ACCIO_DE_MENU.PLAY_GAME;
            }
            else if (accio == ACCIO_DE_MENU.PLAY_GAME)
            {
                accio = ACCIO_DE_MENU.EXIT;
            }
            changeRenderSpriteMenu();
        }
        else if (inputDirection.y < -0.7f && timer > 0.3f)
        {
            timer = 0f;
            if (accio == ACCIO_DE_MENU.PLAY_GAME)
            {
                accio = ACCIO_DE_MENU.EXIT;
            }
            else if (accio == ACCIO_DE_MENU.EXIT)
            {
                accio = ACCIO_DE_MENU.PLAY_GAME;
            }
            changeRenderSpriteMenu();
        }

        if (Input.GetKeyDown(KeyCode.JoystickButton0) == true)
        {
            switch (accio)
            {
            case ACCIO_DE_MENU.PLAY_GAME:
                Application.LoadLevel("MainScene");
                break;

            case ACCIO_DE_MENU.EXIT:
                Application.Quit();
                break;
            }
        }
    }