// Coroutine CRRef;

    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        bgTween.AssignBackgroundsForRegion(region);
        bgTween.changeBackground(level);
        for (int i = 0; i < allCharacters.Count; i++)
        {
            if (i != CharectorStats.SetCurrentHero(CharectorStats.GetCurrentHero())[0])
            {
                allCharacters[i].SetActive(false);
            }
            else
            {
                SelectedHero = allCharacters[i];
            }
        }
        SelectedEnemy     = allEnemies[0];
        characterAnimator = characterHolder.GetComponentInChildren <Animator>();

        heroParticles = SelectedHero.transform.Find("HeroAttackParticles").gameObject;
        characterAnimator.SetBool("inCombat", true);
        bubbles = GetComponentsInChildren <Image>();
        foreach (Image bubble in bubbles)
        {
            bubble.gameObject.SetActive(false);
        }

        int[] heroStats = CharectorStats.SetCurrentHero(CharectorStats.GetCurrentHero());
        SetXPText();
        pDmg             = heroStats[4];
        pHealth          = heroStats[5];
        pCrit            = heroStats[6];
        pAgi             = heroStats[7];
        pDef             = heroStats[8];
        lengthMultiplier = 0;

        stagedGold   = 0;
        stagedShard1 = 0;
        stagedShard2 = 0;

        //event subs
        CombatWordManager.onMaxLengthFound += generateBubble;
        CombatWordManager.onCorrectWord    += spelledWord;
        CombatWordManager.onIncorrectWord  += wrongWord;
        CharectorStats.leveledUp           += onLeveledUp;
        onDamageEnemy += enemyTakeDamage;
        //onDamageEnemy += enemyGotHitAnim;
        onDamagePlayer += playerTakeDamage;
        onDamagePlayer += enemyAttackAnim;
        onEnemyKilled  += nextWord;
        onEnemyKilled  += stageLoot;
        //onEnemyKilled += enemyIsDeadAnim;
        onLevelComplete += levelFinished;
        onLevelComplete += heroCelebrateAnim;
        onPlayerKilled  += gameOverSequence;
        onPlayerKilled  += removeBubble;
        onLevelComplete += enableContinueButton;
        onPlayerKilled  += disableContinueButton;
        InitializePlayer();
        InitializeEnemy();
        displayNewEnemyPrefab();
        InitializeTimer();

        isGameplay = true;
        //StartCoroutine("enemyWalk");
        CombatWordManager.StartLevel();
        wordsLeft = CombatWordManager.Words.Count;
    }
 private void SetToCurrent()
 {
     disableObjects();
     transform.GetChild(CharectorStats.SetCurrentHero(CharectorStats.GetCurrentHero())[0]).gameObject.SetActive(true);
 }
示例#3
0
 void SetHero()
 {
     CharectorStats.SetCurrentHero(CharectorStats.getTempHero());
     Debug.Log("Hero is now: " + CharectorStats.SetCurrentHero(CharectorStats.GetCurrentHero())[0] + CharectorStats.HeroName(CharectorStats.SetCurrentHero(CharectorStats.GetCurrentHero())[0]));
     PlayServices.Instance.SaveData();
 }