public void InitWithNumber(int number)
 {
     currentNumber = number;
     GetComponent <MeshRenderer>().sharedMaterial = NumberMaterials.GetNumberMaterial(number);
     originalPosition        = FLOATING_DISTANCE * parent.faceNormal;
     transform.localPosition = originalPosition;
     transform.localScale    = LABEL_SIZE_SCALE * parent.GetIncircleRadius() * Vector3.one;
     Update();
 }
Beispiel #2
0
        private void Awake()
        {
            instance                   = this;
            numberMaterials            = new Material[numberTextures.Length];
            highlightedNumberMaterials = new Material[numberTextures.Length];
            for (int i = 0; i < numberTextures.Length; i++)
            {
                Material material = Instantiate(baseMaterial);
                material.SetColor("_Color", numberColors[i].TimesIgnoringAlpha(albedoFactor));
                material.SetColor("_EmissionColor", numberColors[i].TimesIgnoringAlpha(emissionFactor));
                material.SetTexture("_MainTex", numberTextures[i]);
                numberMaterials[i] = material;

                Material materialH = Instantiate(highlightedMaterial);
                materialH.SetTexture("_MainTex", numberTextures[i]);
                highlightedNumberMaterials[i] = materialH;
            }
        }
 public void SetHighlighted(bool isHighlighted)
 {
     GetComponent <MeshRenderer>().sharedMaterial = isHighlighted
         ? NumberMaterials.GetHighlightedNumberMaterial(currentNumber)
         : NumberMaterials.GetNumberMaterial(currentNumber);
 }
Beispiel #4
0
 private void OnDestroy()
 {
     instance = null;
 }