/* Recursively check for intersection of the given scene node
* with zone portals. If the node touches a portal, then the
* connected zone is assumed to be touched. The zone adds
* the node to its node list and the node adds the zone to
* its visiting zone list.
*
* NOTE: This function assumes that the home zone of the node
* is correct. The function "_updateHomeZone" in PCZSceneManager
* takes care of this and should have been called before
* this function.
*/
public override void CheckNodeAgainstPortals(PCZSceneNode pczsn, Portal ignorePortal)
{
if (pczsn == mEnclosureNode || pczsn.AllowToVisit == false)
{
// don't do any checking of enclosure node versus portals
return;
}
PCZone connectedZone;
foreach (Portal portal in mPortals)
{
if (portal != ignorePortal && portal.intersects(pczsn) != PortalIntersectResult.NO_INTERSECT)
{
connectedZone = portal.getTargetZone();
if (connectedZone != pczsn.HomeZone && !pczsn.IsVisitingZone(connectedZone))
{
pczsn.AddZoneToVisitingZonesMap(connectedZone);
connectedZone.AddNode(pczsn);
connectedZone.CheckNodeAgainstPortals(pczsn, portal.getTargetPortal());
}
}
}
}