public void Init()
 {
     GameData.instance.atTitleScreen = true;
     tutanim.SetTrigger("reset");
     cursor.SetActive(false);
     MathE.Clamp(ref selectedOption, 0, 3);
     cursor.SetPosition(8, 120 - 16 * selectedOption);
 }
示例#2
0
 public IEnumerator Initialize()
 {
     StartCoroutine(WhatDoText());
     cursor.SetActive(true);
     UpdateBagScreen();
     cursor.SetPosition(8, 120 - 16 * selectedOption);
     currentMenu = mainwindow;
     yield return(0);
 }
示例#3
0
    public IEnumerator WildBattleStart()
    {
        //enemy x pos starts at -28, and goes to 124
        //player x pos starts at 188, and goes to 36
        UpdatePokeBallUI();
        UpdateStatsUI();
        playerObject.SetActive(true);
        enemyMonObject.SetActive(true);
        float initialTimer = 0f;

        while (initialTimer < 1.2f)
        {
            initialTimer += Time.deltaTime;
            playerObject.transform.localPosition   = Vector3.Lerp(new Vector3(188, 76, 0), new Vector3(38, 76, 0), initialTimer / 1.2f);
            enemyMonObject.transform.localPosition = Vector3.Lerp(new Vector3(-28, 116, 0), new Vector3(124, 116, 0), initialTimer / 1.2f);
            yield return(new WaitForEndOfFrame());
        }
        yield return(StartCoroutine(SoundManager.instance.PlayCryCoroutine(PokemonData.MonToID(enemymon.name) - 1)));

        battleoverlay.sprite = battleOverlaySprites[0];
        playerpokeballs.SetActive(true);
        Dialogue.instance.fastText = true;
        yield return(Dialogue.instance.text("Wild " + enemyMons[0].nickname + "\\lappeared!"));

        enemystatsObject.SetActive(true);
        playerpokeballs.SetActive(false);
        battleoverlay.sprite = battleOverlaySprites[3];
        initialTimer         = 0f;
        yield return(new WaitForSeconds(1f));

        playermon = GameData.instance.party[0];
        enemymon  = enemyMons[0];
        Dialogue.instance.keepTextOnScreen = true;
        Dialogue.instance.needButtonPress  = false;
        yield return(Dialogue.instance.text("Go! " + playermon.nickname + "!"));

        while (initialTimer < 0.6f)
        {
            initialTimer += Time.deltaTime;
            playerObject.transform.localPosition = Vector3.Lerp(new Vector3(38, 76, 0), new Vector3(-26, 76, 0), initialTimer / 0.6f);
            yield return(new WaitForEndOfFrame());
        }

        battleMainAnim.SetTrigger("sendOutMon");
        yield return(new WaitForSeconds(1f));

        while (SoundManager.instance.isPlayingCry)
        {
            yield return(new WaitForEndOfFrame());
        }
        Dialogue.instance.Deactivate();
        selectedOption = 0;
        battleState    = BattleState.PlayerTurn;
        currentmenu    = battlemenu;
        cursor.SetActive(true);
    }
示例#4
0
    public IEnumerator Initialize()
    {
        Dialogue.instance.fastText = true;
        yield return(Dialogue.instance.text("What do you want\nto do?", true));

        cursor.SetActive(true);
        UpdateBagScreen();
        cursor.SetPosition(8, 120 - 16 * selectedOption);
        currentMenu = mainwindow;
    }
示例#5
0
 public void CloseMenus()
 {
     Inputs.Enable("start");
     bag.Close();
     cursor.SetActive(false);
     startMenuActive         = false;
     mainMenu.selectedOption = 0;
     mainMenu.Close();
 }
示例#6
0
 public void UpdateMainMenu()
 {
     selectedOption = selectedMon;
     cursor.SetActive(true);
     for (int l = 0; l < 6; l++)
     {
         partyslots[l].SetActive(false);
     }
     for (int i = 0; i < GameData.instance.party.Count; i++)
     {
         if (i == 0)
         {
             numberofPokemon = 0;
         }
         if (GameData.instance.party[i].name != "")
         {
             partyslots[i].SetActive(true);
             numberofPokemon++;
         }
     }
     UpdateMenus();
 }
示例#7
0
 // Update is called once per frame
 void Update()
 {
     if (Inputs.pressed("a"))
     {
         if (MainMenu.instance.currentmenu == MainMenu.instance.badgesmenu)
         {
             SoundManager.instance.PlayABSound();
             MainMenu.instance.currentmenu = MainMenu.instance.thismenu;
             Inputs.Enable("start");
             cursor.SetActive(true);
             this.gameObject.SetActive(false);
         }
     }
 }
    // Use this for initialization

    // Update is called once per frame
    void Update()
    {
        if (isLowerCase)
        {
            nameselectscreen.sprite = lowercase;
        }
        else
        {
            nameselectscreen.sprite = uppercase;
        }
        displaytext.text = futureName;
        if (BeginHandler.instance.givingRedAName || BeginHandler.instance.givingGaryAName)
        {
            maxNameSize = 7;
        }
        else
        {
            maxNameSize = 10;
        }
        if (currentYselection == 5)
        {
            currentXselection = 0;
        }

        cursor.SetPosition(8 + 16 * currentXselection, 96 - 16 * currentYselection);
        if (Inputs.pressed("right"))
        {
            if (currentYselection != 5)
            {
                currentXselection++;
            }
        }
        if (Inputs.pressed("left"))
        {
            if (currentYselection != 5)
            {
                currentXselection--;
            }
        }
        if (Inputs.pressed("up"))
        {
            currentYselection--;
        }
        if (Inputs.pressed("down"))
        {
            currentYselection++;
        }
        MathE.Wrap(ref currentXselection, 0, 8);
        MathE.Wrap(ref currentYselection, 0, 5);

        if (Inputs.pressed("b"))
        {
            if (futureName.Length > 0)
            {
                futureName = futureName.Remove(futureName.Length - 1);
            }
        }
        if (Inputs.pressed("start"))
        {
            if (futureName.Length != 0)
            {
                if (BeginHandler.instance.givingRedAName)
                {
                    GameData.instance.playerName = futureName;
                    BeginHandler.instance.tutanim.SetTrigger("transition");
                    Dialogue.instance.enabled            = true;
                    BeginHandler.instance.givingRedAName = false;
                    this.gameObject.SetActive(false);
                }
                if (BeginHandler.instance.givingGaryAName)
                {
                    GameData.instance.rivalName = futureName;
                    BeginHandler.instance.tutanim.SetTrigger("transition");
                    Dialogue.instance.enabled             = true;
                    BeginHandler.instance.givingGaryAName = false;
                    this.gameObject.SetActive(false);
                }

                BeginHandler.instance.currentmenu = null;
            }
        }
        if (Inputs.pressed("a"))
        {
            if (currentXselection == 8 && currentYselection == 4)
            {
                if (futureName.Length != 0)
                {
                    if (BeginHandler.instance.givingRedAName)
                    {
                        GameData.instance.playerName = futureName;
                        BeginHandler.instance.tutanim.SetTrigger("transition");
                        Dialogue.instance.enabled            = true;
                        BeginHandler.instance.givingRedAName = false;
                        cursor.SetActive(false);
                        this.gameObject.SetActive(false);
                    }
                    if (BeginHandler.instance.givingGaryAName)
                    {
                        GameData.instance.rivalName = futureName;
                        BeginHandler.instance.tutanim.SetTrigger("transition");
                        Dialogue.instance.enabled             = true;
                        BeginHandler.instance.givingGaryAName = false;
                        cursor.SetActive(false);
                        this.gameObject.SetActive(false);
                    }

                    BeginHandler.instance.currentmenu = null;
                }
            }
            else
            {
                if (currentXselection == 0 && currentYselection == 5)
                {
                    isLowerCase = !isLowerCase;
                }
                else if (futureName.Length == maxNameSize)
                {
                    return;
                }
                else
                {
                    futureName += currentYselection < 3 && isLowerCase ? characters[currentYselection, currentXselection].ToLower() : characters[currentYselection, currentXselection];
                }
            }
        }
    }
示例#9
0
    // Use this for initialization

    // Update is called once per frame
    void Update()
    {
        if (deactivated && !Player.disabled)
        {
            Player.disabled = true;
        }
        buycoinstext [0].text = GameData.instance.money.ToString();
        buycoinstext [1].text = GameData.instance.coins.ToString();
        if (!finishedThePrompt)
        {
            if (Inputs.pressed("a"))
            {
                finishedThePrompt = true;
                StopAllCoroutines();
                Inputs.dialogueCheck = false;
                dialoguetext.text    = "";
                cursor.SetActive(false);
            }
            if (Inputs.pressed("b"))
            {
                switch (taskType)
                {
                case 0:
                    selectedOption = 1;
                    break;

                case 1:
                    selectedOption = 3;
                    break;
                }
                StopAllCoroutines();
                Inputs.dialogueCheck = false;
                dialoguetext.text    = "";
                cursor.SetActive(false);
                finishedThePrompt = true;
            }



            if (Inputs.pressed("down"))
            {
                selectedOption++;
                switch (taskType)
                {
                case 0:
                    MathE.Clamp(ref selectedOption, 0, 1);
                    cursor.SetPosition(120, 72 - 16 * selectedOption);
                    break;

                case 1:
                    MathE.Clamp(ref selectedOption, 0, 2);
                    cursor.SetPosition(120, 40 - 16 * selectedOption);
                    break;
                }
            }
            if (Inputs.pressed("up"))
            {
                selectedOption--;
                switch (taskType)
                {
                case 0:
                    MathE.Clamp(ref selectedOption, 0, 1);
                    cursor.SetPosition(120, 72 - 16 * selectedOption);
                    break;

                case 1:
                    MathE.Clamp(ref selectedOption, 0, 2);
                    cursor.SetPosition(120, 40 - 16 * selectedOption);
                    break;
                }
            }
        }

        if (GameData.instance.textChoice == 2)
        {
            scrollequation = 3 * 0.016f;
        }
        if (GameData.instance.textChoice == 1)
        {
            scrollequation = 2f * 0.016f;
        }
        if (GameData.instance.textChoice == 0)
        {
            scrollequation = 1f * 0.016f;
        }
    }
示例#10
0
文件: Bag.cs 项目: jefferybrakus/poko
    IEnumerator  MainUpdate()
    {
        if (currentBagPosition == 0)
        {
            offscreenindexup   = -1;
            offscreenindexdown = 3;
        }


        amountText.text = amountToTask.ToString();
        if (currentMenu == quantitymenu && Dialogue.instance.finishedText)
        {
            if (Inputs.pressed("down"))
            {
                amountToTask--;
            }
            if (Inputs.pressed("up"))
            {
                amountToTask++;
            }
            if (amountToTask < 1)
            {
                amountToTask = maximumItem;
            }
            if (amountToTask > maximumItem)
            {
                amountToTask = 1;
            }
        }
        if (currentMenu == itemwindow && Dialogue.instance.finishedText)
        {
            if (Inputs.pressed("down"))
            {
                currentBagPosition++;

                if (currentBagPosition == offscreenindexdown && currentBagPosition <= Items.instance.items.Count && Items.instance.items.Count > 3)
                {
                    offscreenindexup++;
                    offscreenindexdown++;
                }
                MathE.Clamp(ref currentBagPosition, 0, Items.instance.items.Count);
                UpdateBagScreen();
            }
            if (Inputs.pressed("up"))
            {
                currentBagPosition--;

                if (currentBagPosition == offscreenindexup && offscreenindexup > -1)
                {
                    offscreenindexup--;
                    offscreenindexdown--;
                }
                MathE.Clamp(ref currentBagPosition, 0, Items.instance.items.Count);
                UpdateBagScreen();
            }


            if (currentBagPosition != Items.instance.items.Count)
            {
                maximumItem = Items.instance.items [currentBagPosition].quantity;
            }
            else
            {
                maximumItem = 0;
            }
        }
        if (currentMenu == null && (currentMenu != quantitymenu || currentMenu != itemwindow))
        {
        }
        else
        {
            if (currentMenu == usetossmenu && Dialogue.instance.finishedText)
            {
                if (Inputs.pressed("down"))
                {
                    selectedOption++;
                    MathE.Clamp(ref selectedOption, 0, 1);
                    UpdateUseTossScreen();
                }
                if (Inputs.pressed("up"))
                {
                    selectedOption--;
                    MathE.Clamp(ref selectedOption, 0, 1);
                    UpdateUseTossScreen();
                }
            }
        }
        if (Inputs.pressed("select") && Dialogue.instance.finishedText && currentBagPosition != Items.instance.items.Count)
        {
            if (!switching)
            {
                switching = true;
                selectCursor.gameObject.SetActive(true);
                selectBag = currentBagPosition;
                UpdateBagScreen();
            }
            else
            {
                //our Bag
                selectCursor.gameObject.SetActive(false);
                Item item = Items.instance.items[selectBag];
                Items.instance.items[selectBag]          = Items.instance.items[currentBagPosition];
                Items.instance.items[currentBagPosition] = item;
                switching = false;
                UpdateBagScreen();
            }
        }
        if (Dialogue.instance.finishedText)
        {
            if (Inputs.pressed("a"))
            {
                SoundManager.instance.PlayABSound();
                if (currentMenu == itemwindow)
                {
                    if (currentBagPosition == Items.instance.items.Count)
                    {
                        MainMenu.instance.selectedOption = 0;
                        MainMenu.instance.currentmenu    = MainMenu.instance.thismenu;
                        this.gameObject.SetActive(false);
                    }
                    else
                    {
                        amountToTask = 1;
                        usetossmenu.SetActive(true);
                        UpdateUseTossScreen();
                        switching = false;
                        selectCursor.gameObject.SetActive(true);
                        cursor.SetActive(true);
                        currentMenu = usetossmenu;
                    }
                }

                else if (currentMenu == usetossmenu)
                {
                    if (selectedOption == 0)
                    {
                        if (Items.instance.items.Count > 0)
                        {
                            ItemMode1();
                            Player.instance.UseItem(Items.instance.items [currentBagPosition].name);
                        }
                    }
                    if (selectedOption == 1)
                    {
                        if (Items.instance.items.Count > 0)
                        {
                            ItemMode2();
                            quantitymenu.SetActive(true);
                            currentMenu = quantitymenu;
                        }
                    }
                }
                else if (currentMenu == quantitymenu)
                {
                    if (ItemMode == 1)
                    {
                        //use item
                    }

                    if (ItemMode == 2)
                    {
                        if (!Items.instance.items[currentBagPosition].isKeyItem)
                        {
                            yield return(Dialogue.instance.text("Is it OK to toss \\l" + Items.instance.items[currentBagPosition].name + "?"));

                            yield return(StartCoroutine(Dialogue.instance.prompt()));

                            if (Dialogue.instance.selectedOption == 0)
                            {
                                yield return(Dialogue.instance.text("Threw away " + Items.instance.items[currentBagPosition].name + "."));

                                StartCoroutine(TossItem());
                            }
                            else
                            {
                                Dialogue.instance.Deactivate();
                                UpdateBagScreen();
                                cursor.SetActive(true);
                                currentMenu = itemwindow;
                            }
                        }
                        else
                        {
                            StartCoroutine(TooImportantToToss());
                        }
                    }
                }
            }
            if (Inputs.pressed("b"))
            {
                SoundManager.instance.PlayABSound();
                if (currentMenu == itemwindow)
                {
                    switching = false;
                    selectCursor.gameObject.SetActive(false);
                    MainMenu.instance.currentmenu = MainMenu.instance.thismenu;
                    Inputs.Enable("start");
                    this.gameObject.SetActive(false);
                }
                else if (currentMenu == usetossmenu)
                {
                    currentMenu = itemwindow;
                    selectCursor.gameObject.SetActive(false);
                    UpdateBagScreen();
                }
                else if (currentMenu == quantitymenu)
                {
                    if (ItemMode == 2)
                    {
                        selectCursor.gameObject.SetActive(false);
                        UpdateBagScreen();
                        currentMenu = itemwindow;
                    }
                }
            }



            foreach (GameObject menu in allMenus)
            {
                if (menu != currentMenu)
                {
                    menu.SetActive(false);
                }
                else
                {
                    menu.SetActive(true);
                }
                if (menu == usetossmenu && (currentMenu == quantitymenu))
                {
                    menu.SetActive(true);
                }

                if (menu == quantitymenu && (currentMenu == itemwindow))
                {
                    menu.SetActive(false);
                }
                if (menu == itemwindow && (currentMenu == quantitymenu || currentMenu == usetossmenu))
                {
                    menu.SetActive(true);
                }
                if (currentMenu == null)
                {
                    indicator.SetActive(false);
                }
            }
        }
    }
示例#11
0
    // Update is called once per frame
    void Update()
    {
        if (!animationsFinished)
        {
            return;
        }
        if (currentMenu == nodatamenu || currentMenu == datamenu)
        {
            int limit = (currentMenu == nodatamenu ? 1 : 2);

            if (Inputs.pressed("down"))
            {
                selectedOption++;
            }
            if (Inputs.pressed("up"))
            {
                selectedOption--;
            }
            if (selectedOption < 0)
            {
                selectedOption = 0;
            }
            if (selectedOption > limit)
            {
                selectedOption = limit;
            }
            cursor.SetPosition(8, 120 - selectedOption * 16);
        }
        if (Inputs.pressed("a") || Inputs.pressed("start"))
        {
            if (currentMenu == null && !titlePokemon.isMoving)
            {
                StartCoroutine("GotoStart");
            }
        }

        if (Inputs.pressed("a"))
        {
            if (currentMenu == nodatamenu)
            {
                if (selectedOption == 0)
                {
                    tutorialmanager.SetActive(true);
                    OakIntroCutsceneHandler.instance.Init();
                    SoundManager.instance.PlaySong(15);
                    startmenu.SetActive(false);
                    this.gameObject.SetActive(false);
                }
                else if (selectedOption == 1)
                {
                    Options.instance.Init();
                    options.SetActive(true);
                    currentMenu = options;
                }
            }

            if (currentMenu == datamenu && selectedOption == 2)
            {
                Options.instance.Init();
                options.SetActive(true);
                currentMenu = options;
            }
        }

        if (Inputs.pressed("b") && startmenu.activeInHierarchy)
        {
            if ((currentMenu == nodatamenu || currentMenu == datamenu))
            {
                startmenu.SetActive(false);
                currentMenu   = null;
                inStartMenu   = false;
                ChosenPokemon = 0;
                ChangePokemon();
                cursor.SetActive(false);
                animationsFinished  = false;
                titleAnimTimer      = 0;
                pokemonAnim.enabled = true;
                pokemonAnim.Play("titlePokemonIdle");
                titleanim.Play("titleAnim", 0, 0);
            }
            if (currentMenu == options)
            {
                currentMenu    = nodatamenu;
                selectedOption = 0;
            }
        }
        foreach (GameObject menu in startmenus)
        {
            if (menu != currentMenu)
            {
                menu.SetActive(false);
            }
            else
            {
                menu.SetActive(true);
            }
        }

        if (!switchingPokemon && !inStartMenu)
        {
            titleAnimTimer += Time.deltaTime;
        }
        if (titleAnimTimer >= 3.33f)
        {
            TitleAnim();
            titleAnimTimer = 0;
        }
    }
示例#12
0
 // Use this for initialization
 public void Initialize()
 {
     currentmenu = thismenu;
     cursor.SetActive(true);
 }
示例#13
0
 void UpdateQuantityScreen()
 {
     cursor.SetActive(false);
     selectCursor.gameObject.SetActive(true);
     UpdateSelectItemCursorPos();
     amountText.text = amountToTask.ToString();
 }
示例#14
0
 public void Init()
 {
     GameData.instance.atTitleScreen = true;
     tutanim.SetTrigger("reset");
     cursor.SetActive(false);
 }
示例#15
0
    // Update is called once per frame
    void Update()
    {
        if (!selectingMon)
        {
            cursor.SetPosition(0, 112 - 16 * selectedSlot);
        }
        if (!cursor.isActive)
        {
            cursor.SetActive(true);
        }
        if (bio.displayingbio)
        {
            cursor.SetActive(false);
        }
        if (mainMenu.currentmenu == mainMenu.pokedexmenu)
        {
            if (Inputs.pressed("b") && !bio.displayingbio)
            {
                SoundManager.instance.PlayABSound();
                if (Player.disabled)
                {
                    Player.disabled = false;
                }
                if (selectingMon)
                {
                    selectingMon = false;
                }
                else
                {
                    Inputs.Enable("start");

                    mainMenu.currentmenu = mainMenu.thismenu;

                    gameObject.SetActive(false);
                }
            }
            if (Inputs.pressed("a") && !bio.displayingbio)
            {
                SoundManager.instance.PlayABSound();

                if (!selectingMon && GameData.instance.pokedexlist[topSlotIndex + selectedSlot - 1].seen)
                {
                    selectingMon = true;
                    cursor.SetPosition(120, 56);
                }
                else if (GameData.instance.pokedexlist[topSlotIndex + selectedSlot - 1].seen)
                {
                    StartCoroutine(bio.DisplayABio(topSlotIndex + selectedSlot));
                }
            }
            if (Inputs.pressed("down"))
            {
                if (!selectingMon)
                {
                    selectedSlot++;
                    if (selectedSlot > 6)
                    {
                        selectedSlot = 6;
                        if (topSlotIndex < GameData.instance.pokedexlist.Count - 6)
                        {
                            topSlotIndex += 1;
                        }
                        UpdateScreen();
                    }
                }
            }
            if (Inputs.pressed("up"))
            {
                if (!selectingMon)
                {
                    selectedSlot--;
                    if (selectedSlot < 0)
                    {
                        selectedSlot = 0;
                        if (topSlotIndex > 1)
                        {
                            topSlotIndex -= 1;
                        }
                        UpdateScreen();
                    }
                }
            }
            if (Inputs.pressed("right"))
            {
                if (!selectingMon)
                {
                    topSlotIndex += 10;
                    if (topSlotIndex > GameData.instance.pokedexlist.Count - 6)
                    {
                        topSlotIndex = GameData.instance.pokedexlist.Count - 6;
                    }
                    UpdateScreen();
                }
            }
            if (Inputs.pressed("left"))
            {
                if (!selectingMon)
                {
                    topSlotIndex -= 10;
                    if (topSlotIndex < 1)
                    {
                        topSlotIndex = 1;
                    }
                    UpdateScreen();
                }
            }
        }
    }