Example #1
0
    /// <summary>
    /// Se encarga de asignar los textos, ejecutar la asgnacion de los readonly y de agregar componentes
    /// </summary>
    public void Awake()
    {
        gameObject.tag = "Heroe";
        disparoDebug   = GameObject.FindGameObjectWithTag("DisparoDebug").GetComponent <Slider>();;
        disparo        = GameObject.FindGameObjectWithTag("Disparo");
        for (int i = 0; i < 20; i++)
        {
            GameObject instancia = Instantiate(disparo);
            instancia.AddComponent <Rigidbody>().useGravity  = false;
            instancia.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeAll;
            disparos[i] = instancia;
            instancia.transform.position = new Vector3(1000, 0, 1000);
            instancia.SetActive(false);
            instancia.AddComponent <Disparo>();
        }
        textAldeano = GameObject.FindGameObjectWithTag("Aldeanotxt").GetComponent <TextMeshProUGUI>();
        textZombie  = GameObject.FindGameObjectWithTag("Zombietxt").GetComponent <TextMeshProUGUI>();
        AsignarReadonlys AsignarVelocidad = new AsignarReadonlys();

        gameObject.AddComponent <Camera>();
        Rigidbody playerRigid = gameObject.AddComponent <Rigidbody>();

        playerRigid.useGravity  = false;
        playerRigid.constraints = RigidbodyConstraints.FreezeAll;
        movCo = Acciones(AsignarVelocidad.vel);
        StartCoroutine(movCo);
    }
Example #2
0
    /// <summary>
    /// Se encarga de dar un componente al azar a los cubos que se generan
    /// </summary>
    public void AsignarComponente()
    {
        AsignarReadonlys asignarReadonlys = new AsignarReadonlys();

        GameObject heroe = GameObject.CreatePrimitive(PrimitiveType.Cube);

        heroe.AddComponent <Heroe>();

        for (int i = 0; i < Random.Range(asignarReadonlys.valorMinimo, GENERACIONMAXIMA); i++)
        {
            int valorGeneracion = Random.Range(0, 2);
            if (valorGeneracion == 0)
            {
                GameObject aldeano = GameObject.CreatePrimitive(PrimitiveType.Cube);
                aldeano.name = "Aldeano";
                aldeano.AddComponent <Aliado.AldeanoScript>();
            }
            else
            {
                GameObject zombie = GameObject.CreatePrimitive(PrimitiveType.Cube);
                zombie.name = "Zombie";
                zombie.AddComponent <Enemigo.ZombieScript>();
            }
        }
    }
Example #3
0
    /// <summary>
    /// Se encarga de asignar los textos, ejecutar la asgnacion de los readonly y de agregar componentes
    /// </summary>
    public void Start()
    {
        textAldeano = GameObject.FindGameObjectWithTag("Aldeanotxt").GetComponent <TextMeshProUGUI>();
        textZombie  = GameObject.FindGameObjectWithTag("Zombietxt").GetComponent <TextMeshProUGUI>();
        AsignarReadonlys AsignarVelocidad = new AsignarReadonlys();

        gameObject.AddComponent <Camera>();
        Rigidbody playerRigid = gameObject.AddComponent <Rigidbody>();

        playerRigid.useGravity  = false;
        playerRigid.constraints = RigidbodyConstraints.FreezeAll;
        movCo = Acciones(AsignarVelocidad.vel);
        tag   = "Heroe";
        StartCoroutine(movCo);
    }