/*void onTriggerEnter2D(Collider2D col){ * print ("choque!"); * if (col.gameObject.tag == "ball") { * print ("tierra!"); * } * }*/ void OnCollisionEnter2D(Collision2D collision) { ContactPoint2D[] contacto = collision.contacts; Vector2 puntos = contacto[0].point; if (collision.gameObject.name == "ball") { if (puntos.x < 0) { gManager.AddScore(1); } else { gManager.AddScore(0); } } }
/// <summary> /// 死亡 /// </summary> private void Dead() { enabled = false; ani.SetBool("death Bool", true); GetComponent <CapsuleCollider2D>().enabled = false; // 關閉碰撞器 rig.Sleep(); //Destroy(gameObject, 2.5f); // 刪除(遊戲物件,延遲秒數) gm.AddScore(score); }