コード例 #1
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.CompareTag("fall"))
     {
         Debug.Log("entrei!!");
         fallground = other.gameObject.GetComponent <Rigidbody2D> ();
         StartCoroutine(test(fallground));
     }
     if (other.gameObject.CompareTag("Enemy"))
     {
         Debug.Log("aaa");
         if (attackCheck.enabled == true)
         {
             Debug.Log("MATOU");
             rgdb = other.gameObject.GetComponent <Rigidbody2D> ();
             rgdb.AddForce(new Vector2(move.x * 1, 0));
             other.gameObject.GetComponent <Animator> ().SetBool("die", true);
             Destroy(other.gameObject, (float)0.8);
         }
         else
         {
             Debug.Log("MORRE PFVR");
             levelManager.RespawnPlayer();
         }
     }
 }
コード例 #2
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.name == "player")
     {
         levelManager.RespawnPlayer();
     }
 }
コード例 #3
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.CompareTag("Enemy"))
     {
         if (attackCheck.enabled == true)
         {
             Debug.Log("MATOU");
             other.gameObject.GetComponent <Animator> ().SetBool("run", false);
             other.gameObject.GetComponent <Animator> ().SetBool("die", true);
             Destroy(other.gameObject, (float)0.8);
         }
         else
         {
             Debug.Log("MORRE PFVR");
             levelManager.RespawnPlayer();
         }
     }
 }