void TrySetLabelMat(Transform tr)
    {
        Renderer rend = tr.GetComponent <Renderer>();

        if (rend != null)
        {
            Material[] curMats = rend.materials;
            for (int i = 0; i < rend.materials.Length; i++)
            {
                curMats[i] = new Material(labelMaterial);
                LabelIdentity identity = rend.GetComponent <LabelIdentity>();
                int           colVal   = 0;
                if (identity != null)
                {
                    colVal = LabelsBucket.GetLabelIndex(identity) + 1;
                    totalLabeledItems++;
                    if (!labeledNames.Contains(identity.labelName))
                    {
                        labeledNames.Add(identity.labelName);
                    }
                }
                else
                {
                    Debug.Log("identity component not found on: " + tr.name + " each renderable must have an LabelIdentity component with a type set. Setting to void Val=[0]");
                    totalVoids++;
                }
                curMats[i].color = new Color32((byte)colVal, (byte)colVal, (byte)colVal, 255);
            }
            rend.materials = curMats;
        }
        else
        {
            //Debug.Log("MechRenderer not found on: " + tr.name + " , won't set.");
        }
    }
Example #2
0
        void ReleaseDesignerOutlets()
        {
            if (ButtonOAuth != null)
            {
                ButtonOAuth.Dispose();
                ButtonOAuth = null;
            }

            if (ButtonRemove != null)
            {
                ButtonRemove.Dispose();
                ButtonRemove = null;
            }

            if (LabelIdentity != null)
            {
                LabelIdentity.Dispose();
                LabelIdentity = null;
            }

            if (LabelIdentityText != null)
            {
                LabelIdentityText.Dispose();
                LabelIdentityText = null;
            }

            if (LabelRefresh != null)
            {
                LabelRefresh.Dispose();
                LabelRefresh = null;
            }

            if (LabelRefreshText != null)
            {
                LabelRefreshText.Dispose();
                LabelRefreshText = null;
            }
        }
 public static int GetLabelIndex(LabelIdentity labelIdentity)
 {
     return(GetLabels()[GetLabel(labelIdentity)]);
 }
    public static BaseLabel GetLabel(LabelIdentity labelIdentity)
    {
        string labelName = labelIdentity.labelName;

        return(GetLabel(labelName));
    }