Esempio n. 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");
        }
    }
Esempio n. 2
0
    private void creacionelementosprimarios()
    {
        //IMPORTADORES AUXILIARES
        GameObject importador_aux;
        GameObject creador_aux;

        //Sintaxis para CREAR nuevo objeto, no se usa NEW
        //puntos_encript = gameObject.AddComponent(typeof(puntitoscrip))as puntitoscrip;
        //vidas_encript = gameObject.AddComponent(typeof(vidasscrip))as vidasscrip;

        importador_aux = Resources.Load("PrefabIniciales/Jugador/Z-Jugador") as GameObject;
        creador_aux    = Instantiate(importador_aux, Vector3.zero, Quaternion.identity);
        creador_aux.transform.position = new Vector3(0, 0, 0);
        creador_aux.transform.Rotate(0, -90, 0, Space.Self);
        creador_aux.transform.localScale = new Vector3(0.9f, 0.9f, 0.9f);
        jugador_obj = creador_aux;
        ////Creacion LUZ JUGADOR
        importador_aux  = Resources.Load("PrefabIniciales/Luz_Jugador") as GameObject;
        creador_aux_luz = Instantiate(importador_aux, Vector3.zero, Quaternion.identity);
        creador_aux_luz.transform.position = new Vector3(0, 0, -14);
        creador_aux_luz.transform.Rotate(0, 0, 0, Space.Self);
        creador_aux_luz.transform.localScale = new Vector3(1, 1, 1);
        luz_jugador = creador_aux_luz.GetComponent <Light>();
        ////Creacion PARTICULAS EN EL ESPACIO
        importador_aux = Resources.Load("PrefabIniciales/ParticulasEspacio") as GameObject;
        creador_aux    = Instantiate(importador_aux, Vector3.zero, Quaternion.Euler(-90, 0, 0));
        creador_aux.transform.position   = new Vector3(0, 0, 56);
        creador_aux.transform.localScale = new Vector3(1, 1, 1);
        ////Creacion MAIN CAMERA
        importador_aux     = Resources.Load("PrefabIniciales/Main Camera") as GameObject;
        creador_aux_camara = Instantiate(importador_aux, Vector3.zero, Quaternion.identity);
        creador_aux_camara.transform.position = new Vector3(0, 0, -20);
        creador_aux_camara.transform.Rotate(0, 0, 0, Space.Self);
        creador_aux_camara.transform.localScale = new Vector3(1, 1, 1);

        jugador_anim_aux = FindObjectOfType <jugador_control_animacion>();
    }
Esempio 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;
        }
    }