public static void CreateGossipUI(ENUM_GossipType gossipType, int value = 0) { GameObject gossipIns = GameObject.Instantiate(m_GossipPerfab); gossipIns.transform.SetParent(m_CanvasPlayer.transform, false); gossipIns.GetComponentInChildren <Text>().text = GossipData.GetGossipData(gossipType, value); GameObject.Destroy(gossipIns.gameObject, 2); GameObject.Find("Player").GetComponent <PlayerValue>().ResetTimerGossip(); }
public static string GetGossipData(ENUM_GossipType gossipType, int value) { List <GossipFormat> temp = new List <GossipFormat>(); foreach (GossipFormat item in m_GossipDataDic[gossipType]) { if (value <= item.GossipValue) { temp.Add(item); } } return(temp[UnityEngine.Random.Range(0, temp.Count)].GossipData); }