void OnTriggerExit2D(Collider2D other) { MovJugador prueba = other.gameObject.GetComponent <MovJugador>(); Physics2D.gravity = new Vector2(0, -9); prueba.enabled = true; }
void OnTriggerEnter2D(Collider2D other) { MovJugador prueba = other.gameObject.GetComponent <MovJugador>(); if (prueba != null) { Physics2D.gravity = new Vector2(0, 0); prueba.enabled = false; } }
//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); } }
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; } }
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); } }
//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); } }
// Use this for initialization void Start() { jugadorAudio = GetComponent <AudioSource>(); jugador = GetComponent <MovJugador>(); vidaActual = vidaIncial; }
// Use this for initialization void Start() { jugador = GetComponent <MovJugador>(); disparo = GetComponentInChildren <DisparoJugador>(); }
void Start() { jugadorAudio = GetComponent <AudioSource>(); jugador = GetComponent <MovJugador>(); anim = GetComponent <Animator>(); }
// Use this for initialization void Start() { jugador = GetComponentInChildren <MovJugador>(); rotacionInicial = transform.rotation; fade = false; }