Example #1
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //CREATING GAMETEXT
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    //message = self explanatory; textSize & material = choose from array in inspector; rotOffset in case instantiating object has weird rot;
    //************************************************************ */
    public TextNode CreateNode(string message, GameTextStyle style, Transform parentTransform, Vector3 positionOffset, Vector3 rotationOffset,
                               GameTextButtonTrigger trigger = null)
    {
        TextNode nodeInstance = Instantiate(textNodePrefab);

        nodeInstance.InitializeNode(message, style, parentTransform, positionOffset, rotationOffset, trigger);
        //sets transform hierarchy position, position, and rotation
        SetNodeTransform(nodeInstance);
        //changes message and sets prefab array on textnode
        ChangeMessage(nodeInstance);
        //changes material (integer index for array)
        ChangeTextMaterial(nodeInstance);
        //changes textsize (based on number not array index)
        ChangeTextSize(nodeInstance);
        //self explanatory -- creates button size depends on message array size already being correct
        ChangeIsButton(nodeInstance);
        return(nodeInstance);
    }
Example #2
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //INITIALIZATION
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /// <summary>
    /// Initializes dictionary used by gametext with a key of type char and an index item of the prefab of the character
    /// ----> methods will need to be called by external source (e.g. game manager)
    ///
    /// This method of initializing gameText autopopulates based on an INITIALARRAY copy of all the prefabs in the environment parented under an object.
    /// This is because it makes it really easy for us to add characters as we fit during development
    /// ---->will eventually want to switch to having them in a preset array so we don't need copies of them in the scene
    /// </summary>
    /// <returns>GameText Character Dictionary</returns>


    //creates a dictionary for us of alphabet prefabs and characters by accessing each index of prefab array and finding out its string character variable
    void Awake()
    {
        //singletoning
        if (generator == null)
        {
            generator = this;
        }
        else if (generator != null)
        {
            //destroy this instance text here.
        }

        GameTextCharacter[] initializer = characterArray;
        for (int i = 0; i < initializer.Length; i++)
        {
            characters.Add(initializer[i].characterID, initializer[i]);
        }

        //MAKE SURE TO ADD CUSTOM BASE STYLES HERE
        style_LabelText    = new GameTextStyle("LabelText", .9f, 1, false, false, false);
        style_Button       = new GameTextStyle("Button", .6f, 1, true, false, false);
        style_HUDMenuLabel = new GameTextStyle("HUDMenuLabel", .1f, 1, false, false, true);
        style_HUDButton    = new GameTextStyle("HUDButton", .07f, 1, true, false, true);
    }