コード例 #1
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (LayerMask.LayerToName(other.gameObject.layer) == "Player")
     {
         GameObject.Destroy(other.gameObject);
         LivesManagerScript.GetComponent <LivesManager>().Dead = true;
     }
 }
コード例 #2
0
    /*
     * //Checks to see if FireTrap turns off
     * void Update()
     * {
     *  if (ParentTrap.GetComponent<FireTrapController>().Fire == false)
     *  {
     *      Debug.Log("Why u delete");
     *      GameObject.Destroy(this.gameObject);
     *  }
     * }    */

    //Flames kill player
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "Player")
        {
            GameObject.Destroy(collision.gameObject);
            LivesManagerScript.GetComponent <LivesManager>().Dead = true;
        }
    }