예제 #1
0
    void OnMouseUp()
    {
        this.gameObject.guiTexture.texture = buttonOkNormal;

        if (buttonName == "Next")
        {
            selectCharacterScript.indexHero += 1;

            if (selectCharacterScript.indexHero >= selectCharacterScript.hero.Length)
            {
                selectCharacterScript.indexHero = 0;
            }

            selectCharacterScript.UpdateHero(selectCharacterScript.indexHero);
        }

        if (buttonName == "Prev")
        {
            selectCharacterScript.indexHero -= 1;

            if (selectCharacterScript.indexHero < 0)
            {
                selectCharacterScript.indexHero = selectCharacterScript.hero.Length - 1;
            }

            selectCharacterScript.UpdateHero(selectCharacterScript.indexHero);
        }
    }
예제 #2
0
    public AudioClip sfxButton;                   //sound effect when click this button

    void OnMouseUp()
    {
        //change texture to "normal"
        this.gameObject.GetComponent <GUITexture>().texture = buttonOkNormal;

        //if button name = Next when click this button, Choose next character
        if (buttonName == "Next")
        {
            selectCharacterScript.indexHero += 1;

            if (selectCharacterScript.indexHero >= selectCharacterScript.hero.Length)
            {
                selectCharacterScript.indexHero = 0;
            }

            selectCharacterScript.UpdateHero(selectCharacterScript.indexHero);
        }

        //if button name = Prev when click this button, Choose previous character
        if (buttonName == "Prev")
        {
            selectCharacterScript.indexHero -= 1;

            if (selectCharacterScript.indexHero < 0)
            {
                selectCharacterScript.indexHero = selectCharacterScript.hero.Length - 1;
            }

            selectCharacterScript.UpdateHero(selectCharacterScript.indexHero);
        }
    }