Ejemplo n.º 1
0
 private void Awake()
 {
     cargarPartida(this.nombre);
     if (pj == null)
     {
         pj = this;
     }
     else if (pj != this)
     {
         Destroy(gameObject);
     }
     cargarPartida(this.nombre);
     DontDestroyOnLoad(gameObject);
 }
Ejemplo n.º 2
0
    public void decision()
    {
        personaje objetivo = FindObjectOfType <ReySlime>();

        System.Random rnd   = new System.Random();
        int           value = rnd.Next(1, 100);

        if (hp == mhp)
        {
            if (pasivasiono == 0)
            {
                ap = (int)Math.Round(ap + iap * 1.2, 0);
            }
            pasivasiono = 1;
        }
        else
        {
            pasivasiono = 0;
            ap          = iap;
        }
        if (activo == true)
        {
            if (value < 20)
            {
                objetivo.cambiaHp((int)Math.Round(ap * 1.2, 0), 'm');
                Debug.Log("Bola magica");
            }
            else if (value < 30)
            {
                objetivo.cambiaHp((int)Math.Round(ap - 0.5 * objetivo.getMr(), 0), 't');
                Debug.Log("perforar");
            }
            else if (value < 36)
            {
                objetivo.cambiaHp((int)Math.Round(ap * 1.3 - objetivo.getMr(), 0), 't');
                cambiaHp((int)Math.Round((ap * 1.3 - objetivo.getMr()) / 2, 0), 'c');
                Debug.Log("drenar");
            }
            else
            {
                objetivo.cambiaHp(ap, 'm');
                Debug.Log("mago basico");
            }
            animator.transform.GetChild(0).GetComponent <Animator>().Play("mago", -1, 0);
        }
        else
        {
            Debug.Log("estoy congelado");
        }
    }
Ejemplo n.º 3
0
    public void decision()
    {
        personaje objetivo = FindObjectOfType <ReySlime>();

        System.Random rnd   = new System.Random();
        int           value = rnd.Next(1, 100);

        if (activo == true)
        {
            if (value < 10)
            {
                System.Random rand  = new System.Random();
                int           valor = rand.Next(1, 100);
                if (valor < 50)
                {
                    objetivo.recibeEstado("ceguera", 1);
                }
                Debug.Log("ceguera");
            }
            else if (value < 20)
            {
                objetivo.cambiaHp((int)Math.Round(ad * 1.1, 0), 'f');
                System.Random rand  = new System.Random();
                int           valor = rand.Next(1, 100);
                if (valor < 50)
                {
                    objetivo.recibeEstado("veneno", 5);
                }
                Debug.Log("veneno");
            }
            else if (value < 40)
            {
                objetivo.cambiaHp(ad * 2, 'f');
                Debug.Log("ataque doble");
            }
            else
            {
                objetivo.cambiaHp(ad, 'f');
                Debug.Log("arquero basico");
            }
            animator.transform.GetChild(0).GetComponent <Animator>().Play("arquero", -1, 0);
        }
        else
        {
            Debug.Log("estoy congelado");
        }
    }
Ejemplo n.º 4
0
    public void decision()
    {
        if (getHper() < 30)
        {
            recibeEstado("ataque1", 3);
        }
        personaje objetivo = FindObjectOfType <ReySlime>();

        System.Random rnd   = new System.Random();
        int           value = rnd.Next(1, 100);

        if (activo == true)
        {
            if (value < 6)
            {
                objetivo.cambiaHp((int)Math.Round((ad * 1.5 - objetivo.getDef()) * mhp / hp, 0), 't');
                cambiaHp(mhp, 't');
                Debug.Log("estocada final");
            }
            else if (value < 16)
            {
                objetivo.cambiaHp((int)Math.Round(ad * 1.5, 0), 'f');
                cambiaHp((int)Math.Round((ad * 1.5 - objetivo.getDef()) / 2, 0), 't');

                Debug.Log("carga");
            }
            else if (value < 36)
            {
                recibeEstado("ataque1", 3);
                Debug.Log("preparacion");
            }
            else
            {
                objetivo.cambiaHp(ad, 'f');
                Debug.Log("espadachin basico");
            }
            animator.transform.GetChild(0).GetComponent <Animator>().Play("espadachin", -1, 0);
        }
        else
        {
            Debug.Log("estoy congelado");
        }
    }
Ejemplo n.º 5
0
    public void decision()
    {
        personaje objetivo = FindObjectOfType <ReySlime>();

        System.Random rnd   = new System.Random();
        int           value = rnd.Next(1, 100);

        if (activo == true)
        {
            if (value < 10)
            {
                Debug.Log("detras de mi");
                npc[] aux = FindObjectsOfType <npc>();
                do
                {
                    objetivo = aux[Random.Range(0, aux.Length)];
                } while (objetivo == this);
                objetivo.recibeEstado("defensa2", 3);
            }
            else if (value < 30)
            {
                Debug.Log("defender");
                this.recibeEstado("defensa1", 2);
            }
            else if (value < 60)
            {
                Debug.Log("golpe de escudo");
                objetivo.cambiaHp(def, 'f');
            }
            else
            {
                Debug.Log("tank basico");
                objetivo.cambiaHp(ad, 'f');
            }
            animator.transform.GetChild(0).GetComponent <Animator>().Play("tank", -1, 0);
        }
        else
        {
            Debug.Log("estoy congelado");
        }
    }
Ejemplo n.º 6
0
    public void decision()
    {
        personaje objetivo = FindObjectOfType <ReySlime>();

        System.Random rnd   = new System.Random();
        int           value = rnd.Next(1, 100);

        if (activo == true)
        {
            if (value < 6)
            {
                objetivo.cambiaHp((int)Math.Round(ap * 1.5, 0), 'm');
                Debug.Log("ataque magico");
            }
            else if (value < 17)
            {
                objetivo = null;
                npc[] aux = FindObjectsOfType <npc>();
                foreach (npc o in aux)
                {
                    o.cambiaHp((int)Math.Round(o.getMhp() * 0.1, 0), 'c');
                }
                Debug.Log("curacion all");
            }
            else if (value < 27)
            {
                objetivo = null;
                npc[] aux = FindObjectsOfType <npc>();
                foreach (npc o in aux)
                {
                    if (objetivo == null || o.getHper() < objetivo.getHper())
                    {
                        objetivo = o;
                    }
                }
                objetivo.cambiaHp((int)Math.Round(objetivo.getMhp() * 0.4), 'c');
                Debug.Log("curacion grande");
            }
            else if (value < 60)
            {
                objetivo = null;
                npc[] aux = FindObjectsOfType <npc>();
                foreach (npc o in aux)
                {
                    if (objetivo == null || o.getHper() < objetivo.getHper())
                    {
                        objetivo = o;
                    }
                }
                objetivo.cambiaHp((int)Math.Round(objetivo.getMhp() * 0.2), 'c');
                Debug.Log("curacion pequeña");
            }
            else
            {
                objetivo.cambiaHp(ap, 'm');
                Debug.Log("healer basico");
            }
            animator.transform.GetChild(0).GetComponent <Animator>().Play("heal", -1, 0);
        }
        Debug.Log("estoy congelado");
    }
Ejemplo n.º 7
0
 // Use this for initialization
 void Awake()
 {
     codigoPersonaje = GameObject.FindGameObjectWithTag("Player").GetComponent <personaje> ();
 }
Ejemplo n.º 8
0
 void Awake()
 {
     codigoPersonaje = GameObject.Find("Protagonista").GetComponent <personaje> ();
 }