Ejemplo n.º 1
0
    void OnTriggerExit2D(Collider2D other)
    {
        MovJugador prueba = other.gameObject.GetComponent <MovJugador>();

        Physics2D.gravity = new Vector2(0, -9);
        prueba.enabled    = true;
    }
Ejemplo n.º 2
0
    void OnTriggerEnter2D(Collider2D other)
    {
        MovJugador prueba = other.gameObject.GetComponent <MovJugador>();

        if (prueba != null)
        {
            Physics2D.gravity = new Vector2(0, 0);
            prueba.enabled    = false;
        }
    }
Ejemplo n.º 3
0
    //10.ATACA AL JUGADOR
    void AtacaJugador(GameObject go)
    {
        MovJugador Jugador = go.GetComponent <MovJugador>();

        if (Jugador != null && !atacando)
        {
            atacando = true;
            animacion.SetBool("Andando", false);
            animacion.SetBool("Ataca", true);
            Invoke("DejaDeAtacar", 0.5f);
        }
    }
Ejemplo n.º 4
0
    void OnTriggerExit2D(Collider2D other)
    {
        Collider2D iniciobat = GetComponent <BoxCollider2D>();
        MovJugador prueba    = other.GetComponent <MovJugador> ();
        Pajaro     mueve     = GetComponent <Pajaro> ();
        Boss2      Ataca     = GetComponent <Boss2> ();

        if (prueba != null)
        {
            Ataca.enabled       = true;
            iniciobat.isTrigger = false;
            mueve.enabled       = true;
        }
    }
Ejemplo n.º 5
0
    void OnTriggerStay2D(Collider2D other)
    {
        MovJugador  prueba = other.gameObject.GetComponent <MovJugador>();
        Rigidbody2D rigid  = other.gameObject.GetComponent <Rigidbody2D>();

        if (prueba.enabled == false && Input.GetKey(KeyCode.W))
        {
            rigid.velocity = new Vector3(0, 3f, 0);
        }
        else if (prueba.enabled == false && Input.GetKey(KeyCode.S))
        {
            rigid.velocity = new Vector3(0, -3f, 0);
        }
        else if (prueba.enabled == false && Input.GetKey(KeyCode.D))
        {
            rigid.velocity = new Vector3(2f, 0, 0);
        }
        else if (prueba.enabled == false && Input.GetKey(KeyCode.A))
        {
            rigid.velocity = new Vector3(-2f, 0, 0);
        }
    }
Ejemplo n.º 6
0
    //2.COLISIONES CON EL JUGADOR
    void OnTriggerEnter2D(Collider2D other)
    {
        MovJugador compJugador = other.GetComponent <MovJugador> ();

        if (compJugador != null && !abierto)
        {
            if (enemigo)
            {
                anim.SetBool("Enemigo", true);
            }

            else
            {
                anim.SetBool("Abierto", true);
            }
            if (abrecofre != null)
            {
                GetComponent <AudioSource>().PlayOneShot(abrecofre);
            }
            Invoke("Abrir", 0.5f);
        }
    }
Ejemplo n.º 7
0
 // Use this for initialization
 void Start()
 {
     jugadorAudio = GetComponent <AudioSource>();
     jugador      = GetComponent <MovJugador>();
     vidaActual   = vidaIncial;
 }
Ejemplo n.º 8
0
 // Use this for initialization
 void Start()
 {
     jugador = GetComponent <MovJugador>();
     disparo = GetComponentInChildren <DisparoJugador>();
 }
Ejemplo n.º 9
0
 void Start()
 {
     jugadorAudio = GetComponent <AudioSource>();
     jugador      = GetComponent <MovJugador>();
     anim         = GetComponent <Animator>();
 }
Ejemplo n.º 10
0
 // Use this for initialization
 void Start()
 {
     jugador         = GetComponentInChildren <MovJugador>();
     rotacionInicial = transform.rotation;
     fade            = false;
 }