IEnumerator StartRound()
    {
        yield return(new WaitForSecondsRealtime(1));



        foreach (TextMeshProUGUI text in spellNames)
        {
            text.text = "";
            text.gameObject.GetComponent <Animator>().SetBool("isFlashing", false);
            text.color = new Color(1, 1, 1, 0);
            text.gameObject.SetActive(false);
        }

        cardHolder.SetSpellName();

        canvasAnim.Play("SpellAdvanceEnd");

        //objectPooler.UnPauseAll();
    }
Beispiel #2
0
    public void CheckAdvancedSpells()
    {
        canAdvanceSpell = false;

        List <int> _tempNumbers   = new List <int>();
        int        _spellsRemoved = 0;

        spellAdvance.beforeMerge = "";
        spellAdvance.afterMerge  = "";
        //if (spellMiniatures.Count > 1)
        //{
        for (int i = 0; i < spellMiniatures.Count; i++)
        {
            string _tempString = "";

            string _tempComponents = "";

            List <SpellCard> _tempList = new List <SpellCard>();

            SpellCard _spellCard = spellMiniatures[i].GetComponent <SpellVisuals>().spell;



            if (_spellCard.advancedSpellComponents.Count == 0)
            {
                //Debug.Log(_spellCard.advancedSpellComponents.Count);

                spellAdvance.beforeMerge += _spellCard.name + " ";

                SpawnMiniature(_spellCard, false, i);

                spellAdvance.afterMerge += _spellCard.name + " ";
            }

            if (_spellCard.advancedSpellComponents.Count > 0)
            {
                if (i + _spellCard.advancedSpellComponents[0].recipeLength < spellMiniatures.Count + 1)
                {
                    _tempString += _spellCard.name + " ";
                    _tempList.Add(_spellCard);
                    for (int j = 1; j < _spellCard.advancedSpellComponents[0].recipeLength; j++)
                    {
                        _tempList.Add(spellMiniatures[i + j].GetComponent <SpellVisuals>().spell);
                        //spellAdvanceText[j].gameObject.SetActive(true);
                        //spellAdvanceText[j].text = _spellCard.name;
                        _tempComponents += spellMiniatures[i + j].GetComponent <SpellVisuals>().spell.name + " ";
                        _tempString     += spellMiniatures[i + j].GetComponent <SpellVisuals>().spell.name + " ";

                        int _number = i + j;
                        _tempNumbers.Add(_number);
                    }
                    if (_tempString == _spellCard.advancedSpellComponents[0].advancedRecipe + " ")
                    {
                        if (spellAdvance.gameObject.activeSelf == false)
                        {
                            spellAdvance.gameObject.SetActive(true);
                        }

                        if (canAdvanceSpell == false)
                        {
                            canAdvanceSpell = true;
                        }

                        spellAdvance.InitialSetup(_spellCard);

                        /*GameObject _spawnedMiniature = objectPooler.SpawnFromPool("CombatMiniature", Vector3.zero, Quaternion.identity, playerScript.playerCanvas.transform);
                         * _spawnedMiniature.transform.localPosition = Vector3.zero;
                         * _spawnedMiniature.transform.localRotation = Quaternion.Euler(Vector3.zero);
                         * SpellVisuals _spawnedMiniatureSpell = _spawnedMiniature.GetComponent<SpellVisuals>();
                         * _spawnedMiniatureSpell.spell = _spellCard.advancedSpellComponents[0].advancedSpell;
                         * _spawnedMiniatureSpell.LoadSpell(_spellCard.advancedSpellComponents[0].advancedSpell);
                         * cardHolder.spellMiniatures.Add(_spawnedMiniature);*/

                        SpawnMiniature(_spellCard, true, i);


                        spellAdvance.beforeMerge += _spellCard.name + " ";
                        spellAdvance.beforeMerge += _tempComponents;

                        spellAdvance.whichFlashing.Add(i);
                        foreach (int num in _tempNumbers)
                        {
                            spellAdvance.whichFlashing.Add(num);
                        }


                        spellAdvance.whichFlashingAfter.Add(i - _spellsRemoved);
                        _spellsRemoved += _spellCard.advancedSpellComponents[0].recipeLength - 1;

                        spellAdvance.afterMerge += _spellCard.advancedSpellComponents[0].advancedSpell.name + " ";

                        i          += _spellCard.advancedSpellComponents[0].recipeLength - 1;
                        _tempString = "";

                        foreach (SpellCard s in _tempList)
                        {
                            combatMenu.MoveCardToDestination(s, CardDestination.Hand, CardDestination.Graveyard);
                        }
                    }
                    else
                    {
                        spellAdvance.beforeMerge += _spellCard.name + " ";

                        SpawnMiniature(_spellCard, false, i);

                        spellAdvance.afterMerge += _spellCard.name + " ";
                    }
                }
                else
                {
                    spellAdvance.beforeMerge += _spellCard.name + " ";

                    SpawnMiniature(_spellCard, false, i);

                    spellAdvance.afterMerge += _spellCard.name + " ";
                }



                /*if (_spellCard.advancedSpellComponents.Count > 0)
                 * {
                 *
                 *  spellAdvance.beforeMerge += _spellCard.name + " ";
                 *  Debug.Log(spellAdvance.beforeMerge);
                 *
                 *  SpawnMiniature(_spellCard);
                 *
                 *  spellAdvance.afterMerge += _spellCard.name + " ";
                 *
                 * }*/
            }
        }
        //}
        List <GameObject> _tempMiniatures = new List <GameObject>();

        foreach (GameObject sm in spellMiniatures)
        {
            _tempMiniatures.Add(sm);
        }

        foreach (GameObject sm in _tempMiniatures)
        {
            sm.GetComponent <SpellMiniature>().spellSlot.StartCoroutine("LerpMovementBack");
        }

        //spellAdvance.SetSpellNames();
        if (canAdvanceSpell == true)
        {
            canvasAnim.Play("SpellAdvance");
        }
        else
        {
            TurnBarScript.Instance.UnPause();
            cardHolder.SetSpellName();
            combatMenu.MenuUnPause();
        }
    }