private static void SetMutations(BuildingLot _lot) { // Find out how many mutations this building can have // (max 1 for each size) if (MutationNegX(_lot)) { _lot.GetMutationList().Add(0); // NegX } if (MutationPosX(_lot)) { _lot.GetMutationList().Add(1); // PosX } if (MutationNegZ(_lot)) { _lot.GetMutationList().Add(2); // NegZ } if (MutationPosZ(_lot)) { _lot.GetMutationList().Add(3); // PosZ } //pass through how many possible mutations, // Randomly set no of mutations for building // randomly choose face to mutate, check if possible? if so apply change if (_lot.GetMutationList().Count > 0) // Cant mutation a building with no room! { ApplyMutations(_lot); } }
private static void ApplyMutations(BuildingLot _lot) { int maxMutations = 0; maxMutations = (int)Random.Range(0, _lot.GetMutationList().Count + 1); while (_lot.GetMutationList().Count > 0) { // Randomly choose face int face = (int)Random.Range(0, _lot.GetMutationList().Count); int direction = _lot.GetMutationList()[face]; DirectMutation(_lot, direction); //Remove possible mutation from list for (int i = 0; i < _lot.GetMutationList().Count; i++) { if (_lot.GetMutationList()[i] == direction) { _lot.GetMutationList().RemoveAt(i); continue; } } } }