private TeleporCheckResult ChannelAndTagCheck(GameObject Traveler, Teleporter DestinationTeleporter) { if (DestinationTeleporter != gameObject.GetComponent <Teleporter>()) { if (DestinationTeleporter.TeleporterType == TeleporterBehaviorMode.Sender) { return(TeleporCheckResult.WrongType); } else { if (DestinationTeleporter.GetChannel() == Channel) { if (DestinationTeleporter.GetReceivesAnyTag()) { //good channel and teleporter accepts any tag return(TeleporCheckResult.Successful); } else { foreach (string WhiteListTag in DestinationTeleporter.GetReceiveWhiteList()) { if (WhiteListTag == Traveler.tag) { //good channel and traveler tag match return(TeleporCheckResult.Successful); } } //not in whitelist return(TeleporCheckResult.NotInWhiteList); } } else { //wrong channel return(TeleporCheckResult.WrongChannel); } } } else { return(TeleporCheckResult.SenderIsDestination); } }