コード例 #1
0
 public void SetPrivates(string text, Vector2 startingPosition, TextType type, TextThickness thickness)
 {
     if (type == TextType.HpCritical)
     {
         text += "!";
     }
     StartingPosition   = startingPosition;
     transform.position = new Vector2(startingPosition.x, startingPosition.y);
     _positionToReach   = new Vector2(startingPosition.x, startingPosition.y + 0.25f);
     _text        = GetComponent <TMPro.TextMeshPro>();
     _text.font   = thickness == TextThickness.Thick ? Fonts[0] : Fonts[1];
     _material    = Helper.MaterialFromTextType(type.GetHashCode(), thickness);
     _text.text   = "<material=\"" + _material + "\">" + text + "</material>";
     _colorToFade = new Color(_text.color.r, _text.color.g, _text.color.b, 0.0f);
     _shadow      = transform.GetChild(0).GetComponent <SpriteRenderer>();
     _shadow.transform.localScale = new Vector3(_text.preferredWidth + 0.15f, _text.preferredHeight - 0.15f, 1.0f);
     _isMoving = true;
 }