private void PlaceFoodPatches(int n) { if (FOOD_PATCH_NUM > 9) { throw new ArgumentOutOfRangeException("Food patch must be no greater than 0"); } Shuffle shuffle = new Shuffle(9); for (int i = 0; i < FOOD_PATCH_NUM; i++) { int ninth = shuffle.GetNext(); if (ninth == 4) { ninth = shuffle.GetNext(); } Vector3 location = new Vector3( (ninth % 3) * (WIDTH / 3f) + MIN_X + UnityEngine.Random.value * (WIDTH / 3f), (ninth / 3) * (HEIGHT / 3f) + MIN_Y + UnityEngine.Random.value * (HEIGHT / 3f), 0 ); antFactory.CreateFoodPatch(location); } }