IsVisitingZone() public method

public IsVisitingZone ( PCZone zone ) : bool
zone PCZone
return bool
Esempio n. 1
0
        /* 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());
                    }
                }
            }
        }
Esempio n. 2
0
		/* 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() );
					}
				}
			}
		}
Esempio n. 3
0
		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 p in mPortals )
			{
				//Check if the portal intersects the node
				if ( p != ignorePortal &&
					p.intersects( pczsn ) != PortalIntersectResult.NO_INTERSECT )
				{
					// node is touching this portal
					connectedZone = p.getTargetZone();
					// add zone to the nodes visiting zone list unless it is the home zone of the node
					if ( connectedZone != pczsn.HomeZone &&
						!pczsn.IsVisitingZone( connectedZone ) )
					{
						pczsn.AddZoneToVisitingZonesMap( connectedZone );
						// tell the connected zone that the node is visiting it
						connectedZone.AddNode( pczsn );
						//recurse into the connected zone
						connectedZone.CheckNodeAgainstPortals( pczsn, p.getTargetPortal() );
					}
				}
			}
		}