Ejemplo n.º 1
0
 public void SetAdRandomTexture(Material adMaterial)
 {
     if (Random.Range(0, 10) <= 3)
     {
         int randomIndex = Random.Range(0, ResourcesController.StaticAdPicTextures.Length);
         adMaterial.SetTexture(MainTexPropertyId, ResourcesController.StaticAdPicTextures[randomIndex]);
     }
     else
     {
         adMaterial.SetTexture(MainTexPropertyId, AdGenerator.GetRandomAdTexture());
     }
 }
Ejemplo n.º 2
0
    void Start()
    {
        Transform       backgroundTransform = transform.GetChild(0).GetChild(0);
        TextMeshProUGUI textMesh            = backgroundTransform.GetChild(0).GetComponent <TextMeshProUGUI>();

        textMesh.text = AdGenerator.generateAd();

        float r = Random.Range(0, 200) / 255f;
        float g = Random.Range(0, 200) / 255f;
        float b = Random.Range(0, 200) / 255f;

        textMesh.color = new Color(
            r > 0.5 ? 0 : 1,
            g > 0.5 ? 0 : 1,
            b > 0.5 ? 0 : 1
            );

        backgroundTransform.GetComponent <RawImage>().color = new Color(r, g, b);
    }