/// <summary>Determines whether the specified citizen must be processed as a virtual citizen.</summary> /// <typeparam name="TAI">The type of the citizen's AI.</typeparam> /// <param name="humanAI">The citizen AI reference.</param> /// <param name="citizen">The citizen to check.</param> /// <param name="realizeCitizen">A callback to determine whether a virtual citizen should be realized.</param> /// <returns><c>true</c> if the citizen must be processed as a virtual citizen; otherwise, <c>false</c>.</returns> protected bool IsCitizenVirtual <TAI>(TAI humanAI, ref TCitizen citizen, Func <TAI, bool> realizeCitizen) { if (CitizenProxy.GetInstance(ref citizen) != 0) { return(false); } uint virtualChance; switch (Config.VirtualCitizens) { case VirtualCitizensLevel.None: return(false); case VirtualCitizensLevel.Few: virtualChance = FewVirtualCitizensChance; break; case VirtualCitizensLevel.Vanilla: return(!realizeCitizen(humanAI)); case VirtualCitizensLevel.Many: virtualChance = ManyVirtualCitizensChance; break; default: return(false); } return(CitizenMgr.GetInstancesCount() * 100 / CitizenInstancesMaxCount < virtualChance ? !realizeCitizen(humanAI) : Random.ShouldOccur(virtualChance)); }