public Text AddText(string str, Dialogue pannel, EType type, EMaterial material, ETextStyle style, Vector3 position, float speed = 0, float angle = 0, float acc = 0, float ang_vec = 0) { // To cache in pool (or reuse instances) Text text = new Text(_fonts[0], style, 40, str); // Number of composites needed int strlen = (str == null ? 0 : str.Length); if (style == ETextStyle.SHADOW) { strlen *= 2; } AddComposites(text, strlen, type, material); text.Material = material; text.pannel = pannel; text.CopyData(null, type, material, position, speed, angle, acc, ang_vec); PullAdd(text); SetupBullet(text); // Add the bullet to active list text.Active = true; _active.Add(text); return(text); }
// /!\ This is a constructor so we may want to remove it public Text(Font font, ETextStyle style, int font_size, string str) { _font = font; _font_size = font_size; _factor = 16 / _font_size; _str = str; _textstyle = style; Owner = EOwner.NONE; }
public GameObject CreateTextElement(GameObject Parent, string TextString, string Name = "text", ETextStyle Style = ETextStyle.TS_DEFAULT) { GameObject gob = CreateElement(Parent, Name); Text text = gob.AddComponent <Text>(); if (Style == ETextStyle.TS_HEADING) { text.font = HeadingFont; text.fontSize = HeadingFontSize; } else { text.font = DefaultFont; text.fontSize = DefaultFontSize; } text.text = TextString; return(gob); }