private void CreateVisualTexts(int count, GameObject owner) { for (int i = 0; i < count; i++) { GameObject tmp = GameObject.Instantiate(pooledObjects[0], owner.transform.position, Quaternion.identity); InGameVisualText text = tmp.GetComponent <InGameVisualText>(); text.Hide(); } }
public void ShowDamage(float damage) { InGameVisualText tmp = visualTexts.Find(x => x.startShowing == false); if (tmp == null) { if (curVisibleVisualTexts.Count > 0) { curVisibleVisualTexts[0].Hide(); tmp = curVisibleVisualTexts[0]; curVisibleVisualTexts.RemoveAt(0); } } tmp.Hide(); tmp.ShowUp(damage, TextColour.RED, 0.5f); curVisibleVisualTexts.Add(tmp); }