コード例 #1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         SceneConfig.KillPlayer();
     }
 }
コード例 #2
0
 // Start is called before the first frame update
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.collider.tag == "Player")
     {
         SceneConfig.KillPlayer();
     }
 }
コード例 #3
0
ファイル: RockBehav.cs プロジェクト: ProjektSM/Projekt2019
    private void OnCollisionEnter2D(Collision2D collision)
    {
        float fallSpeed = GetComponent <Rigidbody2D>().velocity.y;

        if (collision.collider.tag == "Player" && fallSpeed < -1)
        {
            SceneConfig.KillPlayer();
        }
    }