protected void TryApplyTexture(SkinElement element, Renderer rend, bool canBeTransparent = false) { if (element != null && element.IsDone) { if (!canBeTransparent && element.IsTransparent) { return; } if (canBeTransparent && element.IsTransparent) { rend.enabled = false; } else { if (element.Materials != null) { rend.material = element.Materials[0]; return; } element.Materials = new List <Material>(1); rend.material.mainTexture = element.Texture; element.Materials.Add(rend.material); } } }
protected void TryApplyTexture(SkinElement element, Renderer rend, bool canBeTransparent = false) { if (element != null && element.IsDone) { if (!canBeTransparent && element.IsTransparent) { return; } if (canBeTransparent && element.IsTransparent) { rend.enabled = false; } else { rend.material.mainTexture = element.Texture; } } }
public virtual System.Collections.IEnumerator Reload(string[] newData) { for (int i = 0; i < elements.Count; i++) { SkinElement skin = elements[i]; if (skin == null) { continue; } if (skin.NeedReload || !skin.Path.Equals(newData[i])) { SkinElement element = new SkinElement(newData[i], true); yield return(FengGameManagerMKII.FGM.StartCoroutine(element.TryLoad())); elements[i] = element; } } yield break; }
protected void TryApplyTextures(SkinElement element, Renderer[] renderers, bool canBeTransparent) { if (element != null && element.IsDone) { if (!canBeTransparent && element.IsTransparent) { return; } if (element.Materials == null) { element.Materials = new List <Material>(renderers.Select(x => { x.material.mainTexture = element.Texture; return(x.material); })); } else if (element.Materials.Count != renderers.Length) { element.Materials = new List <Material>(renderers.Select(x => { x.material.mainTexture = element.Texture; return(x.material); })); } for (int i = 0; i < renderers.Length; i++) { var render = renderers[i]; if (canBeTransparent && element.IsTransparent) { render.enabled = false; continue; } render.material = element.Materials[i]; } } }