Esempio n. 1
0
    //////////////////////////////////////////////////////////////////////
    public void OnEnterTrigger(Collider localCollider, Collider externalCollider)
    {
        PortalTraveller traveller = externalCollider.GetComponentInParent <PortalTraveller>();

        if (!traveller || traveller.TravellerCollider != externalCollider)
        {
            return;
        }

        if (localCollider == _physZoneA)
        {
            traveller.OnApproachPortalZone(this, GlobalVars.Instance._layerPortalSideA, GlobalVars.Instance._layerPortalSideB);
        }
        else if (localCollider == _physZoneB)
        {
            traveller.OnApproachPortalZone(this, GlobalVars.Instance._layerPortalSideB, GlobalVars.Instance._layerPortalSideA);
        }
        else if (localCollider == _portalZone)
        {
            traveller.OnEnterPortal();
        }
    }