示例#1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (!collision.CompareTag("hero"))
        {
            return;
        }

        if (_portalManager.Connecting)
        {
            return;
        }

        if (!_portalManager.ConnectionExists(this))
        {
            return;
        }

        Hero = collision.GetComponent <Hero>() ?? collision.GetComponentInParent <Hero>();

        if (Hero.Dead)
        {
            return;
        }

        Activate();
    }