Exemplo n.º 1
0
    public virtual void selecAttack()
    {
        int random = Random.Range(1, 101);

        if (!_weak)
        {
            // fijo
            if (random <= 70)
            {
                random = Random.Range(0, Characters.Count);
                //visual del daño
                _lastHeroToHarm = heroWithMoreLife(Characters[random]);
                Instantiate(_visualDamageOthers, _lastHeroToHarm.transform);
                _lastHeroToHarm.GetComponent <Animator>().Play(Animator.StringToHash("Damage"));
                //recibe el daño
                attack(_lastHeroToHarm, 1, "Ataque directo");
            }
            else
            {
                // en area
                foreach (HeroProperties hero in Characters)
                {
                    Instantiate(_visualDamageOthers, hero.transform);
                    hero.GetComponent <Animator>().Play(Animator.StringToHash("Damage"));
                    attack(hero, 1);
                }
                FindObjectOfType <LevelInformationPanel>().showDialogs("Daño en área", false);
            }
        }
        else
        {
            // aca deberia ser mas mortal
            random = Random.Range(0, Characters.Count - 1);
            //visual del daño
            Instantiate(_visualDamageOthers, Characters[random].transform);
            Instantiate(_visualDamageOthers, Characters[random].transform);
            Characters[random].GetComponent <Animator>().Play(Animator.StringToHash("Damage"));
            //recibe el daño
            attack(Characters[random], 2, "Ataque cargado  ");
        }

        //siguiente personaje en atacar
        _shifts.CurrentHero = _shifts.newChallenge();
        //revisa si mato a alguien
        removeHeroe();
    }
Exemplo n.º 2
0
    IEnumerator selectAttackCoroutine(string word)
    {
        yield return(new WaitForEndOfFrame());

        SaveSystem.increaseMicrophonePressedTime(true, word, ChangeScene.EspikinglishMinigames.RPG);

        if (characterContainsAttack())
        {
            // crea el objeto que muestra cual es que uso

            /*
             * GameObject usedObject = Instantiate(_usedObject);
             * usedObject.GetComponent<SpriteRenderer>().sprite = _currentAttack._sprite;
             * usedObject.GetComponent<AudioSource>().clip = _currentAttack._soundEffect;
             * usedObject.GetComponent<AudioSource>().Play();
             */
            StartCoroutine(createUsedObjectCoroutine());

            if (_currentAttack._cure)
            {
                HeroProperties[]      aux    = FindObjectsOfType <HeroProperties>();
                List <HeroProperties> revive = new List <HeroProperties>();

                foreach (HeroProperties hero in aux)
                {
                    if (!hero.IsLive)
                    {
                        Lamia.addCharacter(hero);
                    }

                    hero.getCharacterStastic(1);
                }

                if (FindObjectOfType <FinalBoss>())
                {
                    FindObjectOfType <FinalBoss>().effectiveAttack(_currentAttack._attack, _hero.Counters);

                    if (FindObjectOfType <FinalBoss>().Counters.Count > 0)
                    {
                        _controlShifts.CurrentHero = _controlShifts.newChallenge();
                    }
                }
                //muestra que gano vida
                Invoke("feeckbackGotLife", 1);
                //para finalizar el turno
                _controlShifts.Invoke("playerEnemy", 4);
                //frase del ataque
                FindObjectOfType <LevelInformationPanel>().showDialogs(_currentAttack._sentenceToCompleteAttack, false);
                _hero.GetComponent <MoveHeroe>().Invoke("changeDirection", 1);
            }
            else
            {
                if (Lamia.effectiveAttack(_typeAttack, _hero.Counters))
                {
                    //aplcia el daño
                    if (Lamia.lostLife(_currentAttack._damage))
                    {
                        if (_controlShifts.CurrentHero.AssociatedObject)
                        {
                            _controlShifts.Invoke("playerEnemy", 6);
                            _controlShifts.CurrentHero.AssociatedObject = false;
                            _hero.GetComponent <MoveHeroe>().Invoke("changeDirection", 3);
                            _controlShifts.CurrentHero = _controlShifts.newChallenge();
                        }
                        else
                        {
                            _controlShifts.Invoke("playerEnemy", 3);
                            _hero.GetComponent <MoveHeroe>().Invoke("changeDirection", 1);
                        }
                    }

                    //frase del ataque
                    FindObjectOfType <LevelInformationPanel>().showDialogs(_currentAttack._sentenceToCompleteAttack, false);
                }
                else
                {
                    if (FindObjectOfType <FinalBoss>())
                    {
                        if (FindObjectOfType <FinalBoss>().Counters.Count > 0 || _controlShifts.CurrentHero.Life <= 1)
                        {
                            _controlShifts.CurrentHero = _controlShifts.newChallenge();
                        }
                    }

                    _controlShifts.Invoke("playerEnemy", 3);
                    FindObjectOfType <LevelInformationPanel>().showDialogs(_currentAttack._sentencesToNotUseAttack, false);
                    _hero.GetComponent <MoveHeroe>().Invoke("changeDirection", 1);
                }
            }
            _hero.GetComponent <HeroProperties>().Attacks.Remove(_currentAttack);
        }
    }