public StarSystem GetSystemWithAttribute(StarSystem.Attributes mask) { for (int n = 0; n < starSystems.Count; n++) { if ((starSystems[n].attributes & mask) != 0) { return(starSystems[n]); } } return(null); }
void PickConnector(Rand64 random, StarSystem.Attributes connectorType) { const int iterations = 5; int pick = 0; for (int n = 0; n < iterations; n++) { pick = random.Range(0, starSystems.Count); if ((starSystems[pick].attributes & (StarSystem.Attributes.NorthConnector | StarSystem.Attributes.EastConnector | StarSystem.Attributes.SouthConnector | StarSystem.Attributes.WestConnector)) == 0) { break; } } starSystems[pick].attributes |= connectorType; }