Exemplo n.º 1
0
        private void Back()
        {
            switch (battleState)
            {
            case BATTLESTATE.DEFAULT:
                break;

            case BATTLESTATE.CHOICES: break;     // Do nothing

            case BATTLESTATE.SONG:
                battleState = BATTLESTATE.CHOICES;
                choicesPanel.gameObject.SetActive(true);
                songPanel.gameObject.SetActive(false);
                attackDescriptionPanel.SetActive(false);
                break;

            case BATTLESTATE.PUNCH:
                battleState = BATTLESTATE.CHOICES;
                choicesPanel.gameObject.SetActive(true);
                punchPanel.gameObject.SetActive(false);
                attackDescriptionPanel.SetActive(false);
                break;

            case BATTLESTATE.ATTACKSPLAY:
                break;

            default:
                break;
            }
        }
Exemplo n.º 2
0
        private IEnumerator bagCoroutine()
        {
            battleState = BATTLESTATE.DEFAULT;
            choicesPanel.gameObject.SetActive(false);

            busy = waitForInput = true;
            smallTxt.Shutup();
            bigTxt.Display(BattleConsts.I.bagText, false, DefaultCallback);

            while (busy)
            {
                yield return(null);
            }
            yield return(new WaitForSeconds(1f));

            busy = true;
            player.PlayAnim("Hit");
            StartCoroutine(player.ModifyHpCoroutine(+50, DefaultCallback));

            while (busy)
            {
                yield return(null);
            }

            busy = true;
            bigTxt.Shutup();
            bigTxt.Display("Miam miam !", true, DefaultCallback);
            while (busy || waitForInput)
            {
                yield return(null);
            }

            StartCoroutine(ennemyCoroutine());
        }
Exemplo n.º 3
0
        private IEnumerator ennemyCoroutine()
        {
            battleState = BATTLESTATE.ENNEMYTURN;
            EnnemyAttack atk = ennemyAttacks.GetRandomAttack();

            // Display text
            busy = waitForInput = true;
            smallTxt.Shutup();
            bigTxt.Display(atk.label, true, DefaultCallback);
            while (busy)
            {
                yield return(null);
            }

            busy = true;
            if (RpgManager.Instance)
            {
                RpgManager.PlaySFX(atk.sfx);
            }

            yield return(new WaitForSeconds(1f));

            // Play animations
            if (atk.damage > 0)
            {
                player.PlayAnim("Hit");
                StartCoroutine(player.ModifyHpCoroutine(-atk.damage, DefaultCallback));
            }
            else if (atk.heal > 0)
            {
                ennemy.PlayAnim("Hit");
                StartCoroutine(ennemy.ModifyHpCoroutine(atk.heal, DefaultCallback));
            }
            while (busy || waitForInput)
            {
                yield return(null);
            }

            if (player.Hp <= 0)
            {
                StartCoroutine(endCoroutine(false));
            }
            else
            {
                busy = true;
                bigTxt.Shutup();
                smallTxt.Display(BattleConsts.I.choiceText, false, DefaultCallback);
                while (busy)
                {
                    yield return(null);
                }
                choicesPanel.gameObject.SetActive(true);
                battleState = BATTLESTATE.CHOICES;
            }
        }
Exemplo n.º 4
0
        private IEnumerator endCoroutine(bool win)
        {
            if (rpg.RpgManager.Instance)
            {
                rpg.RpgManager.CurrentStory.StopMusic();
            }

            if (win)
            {
                audioSource.Play();
            }
            else
            {// Lose a life
                if (RpgManager.Instance)
                {
                    rpg.RpgManager.Player.GetHitFunc(3);
                    this.gameObject.SetActive(false);
                }
            }

            (win ? ennemy : player).animator.SetTrigger("Dead");

            battleState = BATTLESTATE.DEFAULT;
            busy        = waitForInput = true;
            smallTxt.Shutup();
            bigTxt.Display(win ? BattleConsts.I.winText : BattleConsts.I.loseText, true, DefaultCallback);
            while (busy || waitForInput)
            {
                yield return(null);
            }

            if (!win)
            {
                yield break;
            }

            busy = waitForInput = true;
            bigTxt.Display("Morgane gagne 791 993 points d'EXP !", true, DefaultCallback);
            while (busy || waitForInput)
            {
                yield return(null);
            }

            busy = waitForInput = true;
            bigTxt.Display("Morgane monte au niveau 27 !", true, DefaultCallback);

            player.statsPanel.Find("Level").GetComponent <Text>().text = "Lv27";
            while (busy || waitForInput)
            {
                yield return(null);
            }

            rpg.RpgManager.UnloadPokemon();
        }
Exemplo n.º 5
0
        private IEnumerator introCoroutine()
        {
            busy = waitForInput = true;
            smallTxt.Shutup();
            bigTxt.Display("MORGANE est attaquée par ENSIL-ENSCI !", true, DefaultCallback);
            while (busy || waitForInput)
            {
                yield return(null);
            }

            busy = true;
            bigTxt.Shutup();
            smallTxt.Display(BattleConsts.I.choiceText, false, DefaultCallback);
            while (busy)
            {
                yield return(null);
            }
            choicesPanel.gameObject.SetActive(true);
            smallTxt.ShowImg(false);
            battleState = BATTLESTATE.CHOICES;
        }
Exemplo n.º 6
0
        private IEnumerator fleeCoroutine()
        {
            battleState = BATTLESTATE.DEFAULT;
            choicesPanel.gameObject.SetActive(false);

            busy = waitForInput = true;
            smallTxt.Shutup();
            bigTxt.Display(BattleConsts.I.fleeText, true, DefaultCallback);
            while (busy || waitForInput)
            {
                yield return(null);
            }

            busy = true;
            bigTxt.Shutup();
            smallTxt.Display(BattleConsts.I.choiceText, false, DefaultCallback);
            while (busy)
            {
                yield return(null);
            }
            choicesPanel.gameObject.SetActive(true);
            battleState = BATTLESTATE.CHOICES;
        }
Exemplo n.º 7
0
        private IEnumerator fightCoroutine(BattleChoice choice)
        {
            if (choice.currentPp <= 0)
            {
                battleState = BATTLESTATE.DEFAULT;
                songPanel.gameObject.SetActive(false);
                punchPanel.gameObject.SetActive(false);
                attackDescriptionPanel.SetActive(false);

                busy = waitForInput = true;
                smallTxt.Shutup();
                bigTxt.Display("Plus de points de pouvoir !", true, DefaultCallback);
                while (busy || waitForInput)
                {
                    yield return(null);
                }

                busy = true;
                bigTxt.Shutup();
                smallTxt.Display(BattleConsts.I.choiceText, false, DefaultCallback);
                while (busy)
                {
                    yield return(null);
                }
                choicesPanel.gameObject.SetActive(true);
                battleState = BATTLESTATE.CHOICES;
                yield break;
            }
            else
            {
                choice.currentPp--;
            }

            bool isSong = battleState == BATTLESTATE.SONG;

            battleState = BATTLESTATE.ATTACKSPLAY;
            choicesPanel.gameObject.SetActive(false);
            songPanel.gameObject.SetActive(false);
            punchPanel.gameObject.SetActive(false);
            attackDescriptionPanel.gameObject.SetActive(false);

            bool hasResult = !string.IsNullOrEmpty(choice.resultMessage);

            // Display text
            busy = waitForInput = true;
            smallTxt.Shutup();
            bigTxt.Display(choice.message, !hasResult, DefaultCallback);
            while (busy)
            {
                yield return(null);
            }

            busy = true;
            float waitime = 1.0f;

            if (RpgManager.Instance && choice.sfx)
            {
                float oldvolume = RpgManager.CurrentStory.GetMusicVolume();
                if (isSong)
                {
                    RpgManager.CurrentStory.SetMusicVolume(0.3f * oldvolume);
                }
                waitime = Mathf.Max(choice.sfx.length, waitime);
                RpgManager.PlaySFX(choice.sfx);

                yield return(new WaitForSeconds(waitime));

                if (RpgManager.Instance && choice.sfx)
                {
                    RpgManager.CurrentStory.SetMusicVolume(oldvolume);
                }
            }
            else
            {
                yield return(new WaitForSeconds(waitime));
            }

            // Play animations
            ennemy.PlayAnim("Hit");
            StartCoroutine(ennemy.ModifyHpCoroutine(-choice.damage, DefaultCallback));
            while (busy)
            {
                yield return(null);
            }

            // Display result if any
            if (hasResult)
            {
                busy = waitForInput = true;
                bigTxt.Display(choice.resultMessage, true, DefaultCallback);
            }

            while (busy || waitForInput)
            {
                yield return(null);
            }

            if (ennemy.Hp <= 0)
            {
                StartCoroutine(endCoroutine(true));
            }
            else
            {
                StartCoroutine(ennemyCoroutine());
            }
        }
Exemplo n.º 8
0
        private void Select()
        {
            switch (battleState)
            {
            case BATTLESTATE.DEFAULT:
                break;

            case BATTLESTATE.CHOICES:
                string selected = choicesPanel.GetSelectedItem().name;
                switch (selected)
                {
                case "song":
                    battleState = BATTLESTATE.SONG;
                    choicesPanel.gameObject.SetActive(false);
                    songPanel.gameObject.SetActive(true);
                    attackDescriptionPanel.SetActive(true);
                    if (RpgManager.Instance)
                    {
                        RpgManager.PlaySFX(sfx_validate);
                    }
                    break;

                case "punch":
                    battleState = BATTLESTATE.PUNCH;
                    choicesPanel.gameObject.SetActive(false);
                    punchPanel.gameObject.SetActive(true);
                    attackDescriptionPanel.SetActive(true);
                    if (RpgManager.Instance)
                    {
                        RpgManager.PlaySFX(sfx_validate);
                    }
                    break;

                case "bag":
                    StartCoroutine(bagCoroutine());
                    if (RpgManager.Instance)
                    {
                        RpgManager.PlaySFX(sfx_validate);
                    }
                    break;

                case "flee":
                    StartCoroutine(fleeCoroutine());
                    if (RpgManager.Instance)
                    {
                        RpgManager.PlaySFX(sfx_validate);
                    }
                    break;

                default:
                    break;
                }
                break;

            case BATTLESTATE.SONG:
                StartCoroutine(fightCoroutine(songPanel.GetSelectedItem()));
                if (RpgManager.Instance)
                {
                    RpgManager.PlaySFX(sfx_validate);
                }
                break;

            case BATTLESTATE.PUNCH:
                StartCoroutine(fightCoroutine(punchPanel.GetSelectedItem()));
                if (RpgManager.Instance)
                {
                    RpgManager.PlaySFX(sfx_validate);
                }
                break;

            default:
                break;
            }
        }
 public void EndTurnSpeed()
 {
     Crystal = 0;
     _core.getMenuCon().gridViewTrans.Find("EndTurnButton").gameObject.SetActive(false);
     _battleState = BATTLESTATE.Finish;
 }