Exemplo n.º 1
0
            /// <summary>
            /// asignamiento de datos basicos del zombie
            /// </summary>
            void Start()
            {
                if (!Infected)
                {
                    edad        = (int)Random.Range(15, 101);
                    datosZombie = new DatosZombie();
                    Rigidbody Zom;
                    Zom                  = this.gameObject.AddComponent <Rigidbody>();
                    Zom.constraints      = RigidbodyConstraints.FreezeAll;
                    Zom.useGravity       = false;
                    this.gameObject.name = "Zombie";
                }
                else
                {
                    edad = datosZombie.edad;
                    this.gameObject.name = datosZombie.nombre;
                }
                StartCoroutine(buscaAldeanos());
                laVida              = GameObject.FindGameObjectWithTag("Hero").GetComponent <Heroe>();
                porsuingSpeed       = 10 / edad;
                this.gameObject.tag = "Zombie";
                Gusto gusto;

                gusto             = (Gusto)Random.Range(0, 5);
                Gus               = gusto.ToString();
                datosZombie.gusto = Gus;
                this.gameObject.GetComponent <Renderer>().material.color = Color.green;
            }
Exemplo n.º 2
0
            public DatosZombie ObtenerZombieInfo()
            {
                gustos = (Partes)Random.Range(0, 4);
                DatosZombie datos = new DatosZombie();

                if (gustos == Partes.sesos)
                {
                    datos.gustos = Partes.sesos;
                    Debug.Log("warrrrr soy un Zombie y quiero comerme tus" + datos.gustos);
                }
                if (gustos == Partes.corazon)
                {
                    datos.gustos = Partes.corazon;
                    Debug.Log("warrrrr soy un Zombie y quiero comerme tu" + datos.gustos);
                }
                if (gustos == Partes.intestinos)
                {
                    datos.gustos = Partes.intestinos;
                    Debug.Log("warrrrr soy un Zombie y quiero comerme tus " + datos.gustos);
                }

                if (gustos == Partes.estomago)
                {
                    datos.gustos = Partes.estomago;
                    Debug.Log("warrrrr soy un Zombie y quiero comerte tu" + datos.gustos);
                }
                if (gustos == Partes.cuello)
                {
                    datos.gustos = Partes.cuello;
                    Debug.Log("warrrrr soy un Zombie y quiero comerte tu" + datos.gustos);
                }
                return(datos);
            }
Exemplo n.º 3
0
            public DatosZombie Get_Datos_Zomb()
            {
                deseos = (Extremidades)Random.Range(0, 4);
                DatosZombie datos = new DatosZombie();

                switch (deseos)
                {
                case Extremidades.cabeza:
                    datos.deseos = Extremidades.cabeza;
                    Debug.Log("warrrrr soy un Zombie y quiero comerme tus" + datos.deseos);
                    break;

                case Extremidades.cuello:
                    datos.deseos = Extremidades.cuello;
                    Debug.Log("warrrrr soy un Zombie y quiero comerte tu" + datos.deseos);
                    break;

                case Extremidades.torso:
                    datos.deseos = Extremidades.torso;
                    Debug.Log("warrrrr soy un Zombie y quiero comerme tu" + datos.deseos);
                    break;

                case Extremidades.brazos:
                    datos.deseos = Extremidades.brazos;
                    Debug.Log("warrrrr soy un Zombie y quiero comerte tu" + datos.deseos);
                    break;
                }

                return(datos);
            }
Exemplo n.º 4
0
    public DatosZombie ObtenerZombieInfo()
    {
        DatosZombie dato = new DatosZombie();
        // Datos datos = new Datos();
        int parte = UnityEngine.Random.Range(0, 4);

        if (parte == 0)
        {
            dato.partes = cuerpo.corazon;
            mensaje     = "Warrrrr soy un zombie y quiero comer " + dato.partes;
        }
        if (parte == 1)
        {
            dato.partes = cuerpo.cuello;
            mensaje     = "Warrrrrr soy un Zombie y quiero comer " + dato.partes;
        }
        if (parte == 2)
        {
            dato.partes = cuerpo.estomago;
            mensaje     = "Warrrrr soy un zombie y quiero comer " + dato.partes;
        }
        if (parte == 3)
        {
            dato.partes = cuerpo.intestinos;
            mensaje     = "Warrrrr soy un zombie y quiero comer " + dato.partes;
        }
        if (parte == 4)
        {
            dato.partes = cuerpo.sesos;
            mensaje     = "Warrrrr soy un zombie y quiero comer" + dato.partes;
        }
        return(dato);
    }
Exemplo n.º 5
0
    /// <summary>
    /// calculamos la distancia de los objetos con respecto al heroe para hacer la retroalimentacon por medio del canvas
    /// </summary>
    /// <returns></returns>
    IEnumerator BuscaEntidades()
    {
        zombie   = GameObject.FindGameObjectsWithTag("Zombie");
        aldeanos = GameObject.FindGameObjectsWithTag("Villager");

        // retroalimentacion para el aldeano
        foreach (GameObject item in aldeanos)
        {
            yield return(new WaitForEndOfFrame());

            villa.Villager componenteAldeano = item.GetComponent <villa.Villager>();
            if (componenteAldeano != null)
            {
                distancia = Mathf.Sqrt(Mathf.Pow((item.transform.position.x - transform.position.x), 2) + Mathf.Pow((item.transform.position.y - transform.position.y), 2) + Mathf.Pow((item.transform.position.z - transform.position.z), 2));
                if (distancia < 5f)
                {
                    time              = 0;
                    datosAldeano      = item.GetComponent <villa.Villager>().datosAldeano;
                    textoAldeano.text = "Hola, soy " + datosAldeano.nombre + " y tengo " + datosAldeano.edad.ToString() + " años";
                }
                if (time > 3)
                {
                    textoAldeano.text = " ";
                }
            }
        }

        // retroalimentacion para el zombie
        foreach (GameObject itemZ in zombie)
        {
            yield return(new WaitForEndOfFrame());

            zom.Zombie componenteZombie = itemZ.GetComponent <zom.Zombie>();
            if (componenteZombie != null)
            {
                distanciaZ = Mathf.Sqrt(Mathf.Pow((itemZ.transform.position.x - transform.position.x), 2) + Mathf.Pow((itemZ.transform.position.y - transform.position.y), 2) + Mathf.Pow((itemZ.transform.position.z - transform.position.z), 2));
                if (distanciaZ < 5f)
                {
                    time             = 0;
                    datosZombie      = itemZ.GetComponent <zom.Zombie>().datosZombie;
                    textoZombie.text = "Waaaarrrr quiero comer " + datosZombie.gusto;
                }
                if (time > 3)
                {
                    textoZombie.text = " ";
                }
            }
        }
        yield return(new WaitForSeconds(0.1f));

        StartCoroutine(BuscaEntidades());
    }