コード例 #1
0
    public void MakeText(string text, Vector3 Position, Color color, int size, bool ableToMove)
    {
        GameObject   newText    = GameObject.FindGameObjectWithTag(Tags.GameController).GetComponent <ObjectPool>().GetObjectForType("Text", false);
        TextBehavior textScript = newText.GetComponent <TextBehavior>();

        textScript.SetPosition(Position);
        textScript.SetResetTime(2f);
        textScript.SetAbleToMove(ableToMove);
        Text textComponent = newText.GetComponent <Text>();

        textComponent.text     = text;
        textComponent.fontSize = size;
        textComponent.color    = color;
    }
コード例 #2
0
    public IEnumerator CreateDialogue(string text, Vector3 position)
    {
        GameObject   newText    = GameObject.FindGameObjectWithTag(Tags.GameController).GetComponent <ObjectPool>().GetObjectForType("Text", false);
        TextBehavior textScript = newText.GetComponent <TextBehavior>();

        textScript.SetPosition(position);
        textScript.SetAbleToMove(false);
        Text textComponent = newText.GetComponent <Text>();

        textComponent.color = Color.black;
        textComponent.text  = "";
        textScript.SetResetTime(5f);
        char[] allCharsInText = text.ToCharArray();
        foreach (char characters in allCharsInText)
        {
            textComponent.text += characters;
            yield return(new WaitForSeconds(0.04f));
        }
    }