private void MakeChickenPhoto() { m_LastPolaroid = configurations[RNG.Instance.Next(0, configurations.Length)]; if (Session.instance.numEggs == 0) { if (firstLevelConfiguration != null) { m_LastPolaroid = firstLevelConfiguration; } else { Logger.Warn("Missing PolaroidConfig for first level!"); } } // display foreground _background.GetComponent <Image>().sprite = m_LastPolaroid.Background; // display foreground Image image = _foreground.GetComponent <Image>(); image.sprite = m_LastPolaroid.Foreground; image.enabled = image.sprite != null; // clear chicken mounts foreach (Transform slot in ChickenSlots) { slot.GetComponent <Image>().enabled = false; } foreach (var pilotConfig in PeacockAndKiwi) { pilotConfig.Slot.gameObject.SetActive(false); } int numberOfChickensToDisplay = 1; if (Session.instance.currentLevel.value > 1 && RNG.Instance.NextBool()) { numberOfChickensToDisplay = 2; } using (PooledList <Sprite> foregroundChickens = PooledList <Sprite> .Create()) { // HORRIBLE HACK GameObject screen = GameObject.FindGameObjectWithTag("GameScreen"); MyScreen myScreen = screen.GetComponent <MyScreen>(); int brownCount = myScreen.onesColumn.GetNumWithColor(CreatureCtrl.COLOR_BROWN) + myScreen.tensColumn.GetNumWithColor(CreatureCtrl.COLOR_BROWN) * 10; int goldCount = myScreen.tensColumn.GetNumWithColor(CreatureCtrl.COLOR_GOLD) * 10; int whiteCount = myScreen.onesColumn.GetNumWithColor(CreatureCtrl.COLOR_WHITE) + myScreen.tensColumn.GetNumWithColor(CreatureCtrl.COLOR_WHITE) * 10; bool bCheckExclusionList = Optimizer.instance.DisableMasks; if (brownCount == 1) { Sprite brownChicken = null; while (brownChicken == null) { brownChicken = RNG.Instance.Choose(m_LastPolaroid.BrownChickens); if (bCheckExclusionList && ExcludedOnLowEnd.Contains(brownChicken)) { brownChicken = null; } } string brownChickenPose = brownChicken.name; foregroundChickens.Add(brownChicken); Sprite whiteChicken = null; int tries = m_LastPolaroid.WhiteChickens.Length * 2; while (whiteChicken == null && --tries >= 0) { whiteChicken = RNG.Instance.Choose(m_LastPolaroid.WhiteChickens); if (whiteChicken.name.Contains(brownChickenPose) || (bCheckExclusionList && ExcludedOnLowEnd.Contains(whiteChicken))) { whiteChicken = null; } } if (whiteChicken != null) { foregroundChickens.Add(whiteChicken); } else { numberOfChickensToDisplay = 1; } } else if (brownCount >= 2) { AddValidPoses(foregroundChickens, m_LastPolaroid.BrownChickens); } else { AddValidPoses(foregroundChickens, m_LastPolaroid.WhiteChickens); if (foregroundChickens.Count < 2) { numberOfChickensToDisplay = 1; } } ChickenSlots.Shuffle(); for (int i = 0; i < numberOfChickensToDisplay; ++i) { int chickenIndex = (i % foregroundChickens.Count); if (chickenIndex == 0) { foregroundChickens.Shuffle(); } Image slot = ChickenSlots[i].GetComponent <Image>(); slot.sprite = foregroundChickens[chickenIndex]; slot.enabled = true; //slot.SetNativeSize(); } } }