123456789101112131415161718192021222324252627282930 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class ReadTextureFromList : MonoBehaviour
- {
- public bool isVirus;
- public List<Texture2D> TextureList;
- public int IndexTexture;
- const float SPERM_SCALE_FACTOR = .5f;
- static float scaleFactor = SPERM_SCALE_FACTOR;
- void Start()
- {
- if(!isVirus)
- {
- TextureList = TextureManager.Instance.ListTexturesSpermsCelebrity;
- }
- Init();
- }
- public void Init()
- {
- Material m = GetComponent<Renderer>().material;
- m.mainTexture = TextureList[IndexTexture];
- //m.mainTextureScale = new Vector2(TextureList[IndexTexture].width, TextureList[IndexTexture].height);
- transform.localScale = new Vector3(TextureList[IndexTexture].width * scaleFactor, TextureList[IndexTexture].height * scaleFactor);
- }
- }
|