private Photo CreatePhoto(GameObject prefab, RewordInfo rewordInfo, RewordWebInfo rewordWeb) { GameObject obj = GameObject.Instantiate <GameObject>(prefab, parent); obj.name = index.ToString(); Photo photo = obj.GetComponent <Photo>(); photo.Init(baseFireMaterial, rewordInfo, rewordWeb); StartShot(photo); photos.Add(photo); index++; return(photo); }
public void Init(Material baseFireMat, RewordInfo rewordInfo, RewordWebInfo webInfo) { Material fireMat = new Material(baseFireMat.shader); fireMat.CopyPropertiesFromMaterial(baseFireMat); string image = webInfo.image; string path = image.Substring(1, image.Length - 1 - ImageFormat.Length); Debug.LogError(path); rewordInfo.tex = Resources.Load <Texture>(path); fireMat.SetTexture("_main_texture", rewordInfo.tex); ParticleSystemRenderer renderer = photo_fire.GetComponent <ParticleSystemRenderer>(); renderer.material = fireMat; renderer.trailMaterial = fireMat; pickture.GetComponent <RectTransform>().anchoredPosition = rewordInfo.pos; obj = pickture.gameObject; nameText.text = webInfo.department + " " + webInfo.name; nameGroup.alpha = 0; }