/* To calculate the level of the given node. */ public uint level(Node d) { if (d.GetType() == typeof(Bridge)) { return(uint.Parse(d.id.Split()[1])); //given node is a bridge, return it's level } else { return(0); } }
// Valid destination in zone public static bool RZone(Pack pack, Node destination) { if (destination.GetType().Name == "Bridge") // Lower bridge { if (Dungeon.current.level(destination) != pack.level) { return(false); } } if (pack.location.GetType().Name == "Bridge") // Upper bridge { if (pack.level == Dungeon.current.level(pack.location)) // Redundant? { Bridge bridge = pack.location as Bridge; if (bridge.toNodes.Contains(destination)) { return(false); } } } return(true); }