Exemplo n.º 1
0
    public override IEnumerator AnimationBrawler(bool TwovsTwo, string QuienAtaca, Animation animationBrawler, string NombreDelAtaque, MonoBehaviour BehaviourCall)
    {
        Vector2 PosicionRefec = Vector2.zero;



        libreriaDeScrips libreriaS = GameObject.FindObjectOfType <libreriaDeScrips>();



        RectTransform ObjetoInsta = null;

        PosicionRefec = new Vector2(-144f, -74f);
        //  animationBrawler.AddClip(this.animaBattle[0], "Attack");


        UnityEngine.UI.Image ImagenPersonaje = null;
        if (TwovsTwo == false)
        {
            //ataca de espalda
            if (QuienAtaca == "Player")
            {
                ImagenPersonaje = animationBrawler.GetComponent <animationScritpBatle>().ImagenEnemigo;
                animationBrawler.AddClip(this.animaBattle[0], "Attack");
                PosicionRefec = new Vector2(151f, 81f);
            }
            //ataca de frente
            else if (QuienAtaca == "Enemy")
            {
                ImagenPersonaje = animationBrawler.GetComponent <animationScritpBatle>().imagenePlayer;
                animationBrawler.AddClip(this.animaBattle[1], "Attack");
                PosicionRefec = new Vector2(-236.1f, -115.3f);
            }
        }
        else if (TwovsTwo == true)
        {
            // sin implementaciontodavia
        }

        animationBrawler.Play("Attack");

        yield return(new WaitWhile(() => animationBrawler.GetComponent <libreriaAnimaciones>().Disparador == false));

        animationBrawler.GetComponent <libreriaAnimaciones>().Disparador = false;

        //Parpadeo
        BehaviourCall.StartCoroutine(SecuenciasAux.SecunciaDaño(ImagenPersonaje));

        //audio hit
        AudioClip clip1 = (AudioClip)Resources.Load("Audios/batalla/Electricidad");

        animationBrawler.GetComponent <animationScritpBatle>().AudioVfx.PlayOneShot(clip1);

        //define el daño y ejecuta el efecto
        float Daño = CalculoDaño.CalcularDaño(QuienAtaca, NombreDelAtaque);

        Daño = (int)Daño;
        Debug.Log("valor del daño :  " + Daño);

        BehaviourCall.StartCoroutine(CalculoDaño.EjecutarDaño(QuienAtaca, Daño));



        animationBrawler.GetComponent <libreriaAnimaciones>().Disparador = false;

        ObjetoInsta = CrearObjetos.CrearObjeto("Prefac/Batalla/ImpactoDescarga", "ImpactoDescarga", PosicionRefec);

        yield return(new WaitForSeconds(1.2f));

        MonoBehaviour.Destroy(ObjetoInsta.gameObject);

        bool Activaefecto = false;

        if (SecuenciasAux.RetornaSitieneEstadoAlterado(TwovsTwo, QuienAtaca) == true)
        {
            Activaefecto = CalculoDaño.ProbailidadEfecto(probabilidadEfecto);

            if (Activaefecto == true)
            {
                Debug.Log("Active Electrificado ");
                //Efeto Evenenamiento

                SecuenciasAux.CambiaEstadoCrewild(QuienAtaca, EstadosEnum.Paralize);

                animationBrawler.GetComponent <animationScritpBatle>().dialogue          = true;
                animationBrawler.GetComponent <animationScritpBatle>().TextoDeBatalla[0] = "Descarga Provoca paralisis";

                yield return(new WaitWhile(() => animationBrawler.GetComponent <animationScritpBatle>().dialogue == true));

                yield return(new WaitForSeconds(0.5f));

                animationBrawler.GetComponent <animationScritpBatle>().text.text = "";
            }
        }



        // animationBrawler.GetComponent<animationScritpBatle>().dialogue = true;
        animationBrawler.GetComponent <animationScritpBatle>().TextoDeBatalla[0] = "";
        animationBrawler.GetComponent <animationScritpBatle>().text.text         = "";
        animationBrawler.GetComponent <animationScritpBatle>().dialogue          = true;

        animationBrawler.GetComponent <animationScritpBatle>().pausaIenumerator = false;


        yield return(0);
    }
Exemplo n.º 2
0
    public override IEnumerator AnimationBrawler(bool TwovsTwo, string QuienAtaca, Animation animationBrawler, string NombreDelAtaque, MonoBehaviour BehaviourCall)
    {
        Vector2       PosicionRefec = Vector2.zero;
        RectTransform ObjetoInsta   = null;



        libreriaDeScrips libreriaS = GameObject.FindObjectOfType <libreriaDeScrips>();

        string NombrePLayAnimt = "";

        PosicionRefec = new Vector2(-144f, -74f);
        //  animationBrawler.AddClip(this.animaBattle[0], "Attack");
        ObjetoInsta = CrearObjetos.CrearObjeto("Prefac/Batalla/PinchosEnvenenar", "PinchosEnvenenar", PosicionRefec);

        UnityEngine.UI.Image ImagenPersonaje = null;
        if (TwovsTwo == false)
        {
            //ataca de espalda
            if (QuienAtaca == "Player")
            {
                ImagenPersonaje = animationBrawler.GetComponent <animationScritpBatle>().ImagenEnemigo;
                libreriaS.Batalla.imagenePlayer.sprite = libreriaS.informacionCrewild.CrewillInstancia[libreriaS.Batalla.ActualSelNumPlayer].animaCrewildEspalda[2];
                NombrePLayAnimt = "PinchosSecuencia1";
            }
            //ataca de frente
            else if (QuienAtaca == "Enemy")
            {
                //   animationBrawler.AddClip(this.animaBattle[1], "Attack");
                ImagenPersonaje = animationBrawler.GetComponent <animationScritpBatle>().imagenePlayer;
                libreriaS.Batalla.ImagenEnemigo.sprite = libreriaS.Batalla.EnemigosBatalla[libreriaS.Batalla.ActualSeNumEnemy].animaCrewildFrentre[2];
                NombrePLayAnimt = "PinchosSecuencia2";
            }
        }

        else if (TwovsTwo == true)
        {
            // sin implementaciontodavia
        }

        OpcionesAnimation lAnimacionesAux = ObjetoInsta.GetComponent <OpcionesAnimation>();

        AudioClip clip1 = (AudioClip)Resources.Load("Audios/batalla/Hit poison");

        animationBrawler.GetComponent <animationScritpBatle>().AudioVfx.PlayOneShot(clip1);

        ObjetoInsta.GetComponent <Animation>().Play(NombrePLayAnimt);

        yield return(new WaitWhile(() => lAnimacionesAux.Disparador == false));

        lAnimacionesAux.Disparador = false;


        SecuenciasAux.DevuelveSpriteBase(QuienAtaca);

        ObjetoInsta.GetComponent <PlayScritp>().animacion = new Sprite[1];

        ObjetoInsta.GetComponent <PlayScritp>().animacion[0] = EncontrarMetodo.DevuelveSprite("Sprites/vfx/disparo de energia/ataque 1", "impacto 1");

        //Parpadeo
        BehaviourCall.StartCoroutine(SecuenciasAux.SecunciaDaño(ImagenPersonaje));

        //audio hit
        clip1 = (AudioClip)Resources.Load("Audios/batalla/Hit_Hurt2");
        animationBrawler.GetComponent <animationScritpBatle>().AudioVfx.PlayOneShot(clip1);

        //define el daño y ejecuta el efecto
        float Daño = CalculoDaño.CalcularDaño(QuienAtaca, NombreDelAtaque);

        Daño = (int)Daño;
        Debug.Log("valor del daño :  " + Daño);

        BehaviourCall.StartCoroutine(CalculoDaño.EjecutarDaño(QuienAtaca, Daño));

        yield return(new WaitForSeconds(1.2f));

        MonoBehaviour.Destroy(ObjetoInsta.gameObject);

        bool Activaefecto = false;

        if (SecuenciasAux.RetornaSitieneEstadoAlterado(TwovsTwo, QuienAtaca) == true)
        {
            Activaefecto = CalculoDaño.ProbailidadEfecto(probabilidadEfecto);

            if (Activaefecto == true)
            {
                Debug.Log("Active envenenamiento ");
                //Efeto Evenenamiento
                CalculoDaño.PausaEjecucionEvento = true;
                BehaviourCall.StartCoroutine(SecuenciasAux.EnvenenamientoEfecto(ImagenPersonaje));
                yield return(new WaitWhile(() => CalculoDaño.PausaEjecucionEvento == true));

                SecuenciasAux.CambiaEstadoCrewild(QuienAtaca, EstadosEnum.poison);
            }
        }


        //salir de la seccuencia
        yield return(new WaitWhile(() => CalculoDaño.PausaEjecucionEvento == true));

        yield return(new WaitWhile(() => lAnimacionesAux.Disparador == true));

        lAnimacionesAux.Disparador = false;


        // animationBrawler.GetComponent<animationScritpBatle>().dialogue = true;
        animationBrawler.GetComponent <animationScritpBatle>().TextoDeBatalla[0] = "";
        animationBrawler.GetComponent <animationScritpBatle>().text.text         = "";
        animationBrawler.GetComponent <animationScritpBatle>().dialogue          = true;

        animationBrawler.GetComponent <animationScritpBatle>().pausaIenumerator = false;

        yield return(0);
    }