Пример #1
0
    private GameObject aux_efecto_pick;     //aura


    void Start()
    {
        //VALORES AL CREAR EL OBJETO
        if (GameObject.Find("GameController"))
        {
            gamecontroller_aux = GameObject.Find("GameController").GetComponent <GameController>();
            luz_jugador        = gamecontroller_aux.obt_luz_jugador();
        }
        jugadoranim_aux = FindObjectOfType <jugador_control_animacion>();
        activar_evento  = this.GetComponent <activarodesactivarcontacto>();
        if (luz_jugador != null)
        {
            actual_angulo     = 80;
            actual_intensidad = 170;
            actual_rango      = 30;
        }
        else
        {
            Debug.Log("LUZ Es nulo");
        }
    }
Пример #2
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;
        }
    }