Exemplo n.º 1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        // If the player enters the trigger zone...
        if (other.tag == "Player")
        {
            BoxyControl playerController = other.GetComponent <BoxyControl>();

            playerController.Die();

            // disable collision by destroying myself. Pretty hacky.
            if (hazardClass == HazardClass.Invisible)
            {
                Destroy(transform.root.gameObject);
            }
        }
    }