void OnCollisionEnter2D(Collision2D coll) { if (coll.gameObject.tag == "Player") { life vidaEnemy = coll.gameObject.GetComponent <life>(); coll.gameObject.GetComponent <Player>().charm = true; vidaEnemy.ApplyDamage(damage); DestroyObject(gameObject); } }
void OnCollisionEnter2D(Collision2D coll) { if (coll.gameObject.tag == "Enemy") { foreach (ContactPoint2D contact in coll.contacts) { GameObject temp = Instantiate(hitPrefab) as GameObject; temp.transform.position = contact.point; } life vidaEnemy = coll.gameObject.GetComponent <life>(); vidaEnemy.ApplyDamage(damage); } }
void OnTriggerStay2D(Collider2D coll) { if (coll.tag == "Enemy" && Enemy != null) { if (Input.GetButtonDown("Attack") && !anime.GetCurrentAnimatorStateInfo(0).IsName("Blend Tree")) { GameObject temp = Instantiate(hitPrefab) as GameObject; temp.transform.position = swordHit.position; life vidaEnemy = coll.gameObject.GetComponent <life> (); vidaEnemy.ApplyDamage(basicDamage); } } }
void OnCollisionEnter2D(Collision2D coll) { if (coll.gameObject.tag == "Player") { foreach (ContactPoint2D contact in coll.contacts) { GameObject temp = Instantiate(hitPrefab) as GameObject; temp.transform.position = contact.point; } if (!coll.gameObject.GetComponent <Player>().defense) { vidaEnemy = coll.gameObject.GetComponent <life>(); vidaEnemy.ApplyDamage(damage); } DestroyObject(gameObject); } }