Exemplo n.º 1
0
    //LUZ JUGADOR
    //ANGULO POR DEFECTO 80
    //ANGULO MAXIMO 120
    //INTENSIDAD POR DEFECTO 170
    //RANGO POR DEFECTO 30
    private IEnumerator Ampliarluz()
    {
        //INCREMNTO DE RANGOS E INTENSIDAD DE LUZ DE JUGADOR Y LUZ DE FONDO DE SIGUIENTE NIVEL

        while (luz_jugador.spotAngle < max_angulo)
        {
            luz_jugador.spotAngle += Time.deltaTime * speed;
            speed += speed / 15;
            if (luz_jugador.intensity < max_intensidad)
            {
                luz_jugador.intensity += Time.deltaTime * speed;
            }
            if (luz_jugador.range < 320)
            {
                luz_jugador.range += Time.deltaTime * (speed * 1f);
            }
            yield return(null);
        }
        luz_jugador.spotAngle = max_angulo;
        luz_jugador.intensity = max_intensidad;
        luz_jugador.range     = 320;
        speed = 1;
        yield return(new WaitForSeconds(tiempoampliado));

        //DECREMENTO DE RANGOS E INTENSIDAD DE LUZ DE JUGADOR Y LUZ DE FONDO DE SIGUIENTE NIVEL
        if (!fijo)
        {
            while (luz_jugador.spotAngle > 80)
            {
                //luzjugadr.spotAngle-=Time.deltaTime*speed;
                speed += speed / 30;
                if (luz_jugador.spotAngle > 80)
                {
                    luz_jugador.spotAngle -= Time.deltaTime * speed;
                }
                if (luz_jugador.intensity > min_intensidad)
                {
                    luz_jugador.intensity -= Time.deltaTime * speed;
                }
                if (luz_jugador.range > 50)
                {
                    luz_jugador.range -= Time.deltaTime * (speed * 1.5f);
                }
                yield return(null);
            }
            luz_jugador.spotAngle = 80;
            luz_jugador.intensity = 170;
            luz_jugador.range     = 30;
            speed = 1;
        }
        jugadoranim_aux.desactivarluz();
        if (activar_evento != null)
        {
            activar_evento.resultado_metodo();
        }
        Destroy(aux_efecto_pick);
        Destroy(aux_efecto);
        Destroy(gameObject);
    }
Exemplo n.º 2
0
    public void resetear_propiedades_luz_jugador()
    {
        jugador_anim_aux.desactivarluz();
        luz_jugador.spotAngle = 80;
        luz_jugador.intensity = 170;
        luz_jugador.range     = 30;
        GameObject aux_limpiador = GameObject.FindGameObjectWithTag("Aura_de_item");

        Destroy(aux_limpiador);
    }
Exemplo n.º 3
0
    //void OnCollisionEnter(Collision other)
    //void OnTriggerEnter(Collider other)
    void OnCollisionEnter(Collision other)
    {
        switch (other.gameObject.tag)
        {
        case "Enemy":
        {
        }
        break;

        case "Player":
        {
            if (matar)
            {
                //Freno a CERO el movimiento del jugador
                other.gameObject.GetComponent <Rigidbody>().velocity = Vector3.zero;

                //Se activan comando al perder ( perdida de vidas bloquear navegacion)
                gamecontroller_aux.perder();

                //Se controlan puntajes maximos al perder
                gamecontroller_aux.maximo_puntaje_control();

                //Se crea efecto de muerte
                Instantiate(acrearparamuerte, other.transform.position, Quaternion.identity);

                //Se apaga jugador
                other.gameObject.SetActive(false);


                if (other.gameObject.GetComponent <jugador_control_animacion>() != null)
                {
                    jugador_control_animacion aux = other.gameObject.GetComponent <jugador_control_animacion>();

                    if (aux.estado_luz())
                    {
                        aux.desactivarluz();
                    }
                    gamecontroller_aux.resetear_propiedades_luz_jugador();
                }
                estado = false;
            }
            else
            {
                if (rebotar)
                {
                    auxiliar = other;
                    Vector3 jugador  = auxiliar.transform.position;
                    Vector3 contacto = auxiliar.contacts[0].point;
                    rebote_local(contacto, jugador);
                }
                else
                {
                    if (activaralcontacto)
                    {
                        if (this.GetComponent <activarodesactivarcontacto>() != null)
                        {
                            activarodesactivarcontacto aux = this.GetComponent <activarodesactivarcontacto>();
                            aux.resultado_metodo();
                        }
                    }
                }
            }
        }
        break;

        case "Pared_tag":
        {
            if (gameObject.tag == "Enemy")
            {
                //Creo efecto particulas de "destruccion"
                if (creoalcontactar)
                {
                    Instantiate(acrear, transform.position, Quaternion.identity);
                }
                gamecontroller_aux.sumarpuntos(puntos);                         //Sumo Puntos
                //Detengo sonidos y efecto especiales de persecucion
                if (GetComponent <PathFollower>() != null)
                {
                    PathFollower path_aux = GetComponent <PathFollower>();
                    path_aux.detener_sonidos_persecucion_efectos();
                }
                StartCoroutine(retraso());
            }
        }
        break;
        }
    }