예제 #1
0
    // Place this as an instance in a script to get access to any Text element in that script's object.
    // if null, no text mesh exists in hierarchy or failed to get/add DynamicText script.
    public static DynamicText GetTextMesh(JDMonoBehavior source)
    {
        var textObject = source.GetComponentInChildren<TextMesh>();
        if (textObject != null)
        {
            DynamicText textual = textObject.GetComponent<DynamicText>();
            if (textual == null)
            {
                textual = textObject.gameObject.AddComponent<DynamicText>();
            }

            return textual;
        }

        return null;
    }
예제 #2
0
파일: WeaponBar.cs 프로젝트: jmdjr/jd-bacon
 // gets a weapon bar if it exists on this object.
 public static WeaponBar GetWeaponBar(JDMonoBehavior source)
 {
     var bar = source.GetComponentInChildren<WeaponBar>();
     return bar;
 }