private void ApplyRandomTrait(Worker worker) { Traits component = worker.GetComponent<Traits>(); List<string> list = new List<string>(); foreach (DUPLICANTSTATS.TraitVal gENESHUFFLERTRAIT in DUPLICANTSTATS.GENESHUFFLERTRAITS) { DUPLICANTSTATS.TraitVal current = gENESHUFFLERTRAIT; if (!component.HasTrait(current.id)) { list.Add(current.id); } } Trait trait = null; if (list.Count > 0) { string id = list[Random.Range(0, list.Count)]; trait = Db.Get().traits.TryGet(id); worker.GetComponent<Traits>().Add(trait); InfoDialogScreen infoDialogScreen = (InfoDialogScreen)GameScreenManager.Instance.StartScreen(ScreenPrefabs.Instance.InfoDialogScreen.gameObject, GameScreenManager.Instance.ssOverlayCanvas.gameObject, GameScreenManager.UIRenderTarget.ScreenSpaceOverlay); string text = string.Format(UI.GENESHUFFLERMESSAGE.BODY_SUCCESS, worker.GetProperName(), trait.Name, trait.GetTooltip()); infoDialogScreen.SetHeader(UI.GENESHUFFLERMESSAGE.HEADER).AddPlainText(text); SetConsumed(true); } else { InfoDialogScreen infoDialogScreen2 = (InfoDialogScreen)GameScreenManager.Instance.StartScreen(ScreenPrefabs.Instance.InfoDialogScreen.gameObject, GameScreenManager.Instance.ssOverlayCanvas.gameObject, GameScreenManager.UIRenderTarget.ScreenSpaceOverlay); string text2 = string.Format(UI.GENESHUFFLERMESSAGE.BODY_FAILURE, worker.GetProperName()); infoDialogScreen2.SetHeader(UI.GENESHUFFLERMESSAGE.HEADER).AddPlainText(text2); } }