/// <summary> /// 获取并赋值Material /// </summary> public void SetMaterial(GPUSkinningPlayerResources.MaterialState ms) { if (myRes == null) { Debug.LogWarning("myRes is null"); } currMtrl = myRes.GetMaterial(ms); if (mr.sharedMaterial != currMtrl.material) { mr.sharedMaterial = currMtrl.material; } }
private GPUSkinningMaterial GetCurrentMaterial() { if (res == null) { return(null); } if (playingClip == null) { return(res.GetMaterial(GPUSkinningPlayerResources.MaterialState.RootOff_BlendOff)); } if (playingClip.rootMotionEnabled && rootMotionEnabled) { if (res.IsCrossFadeBlending(lastPlayedClip, crossFadeTime, crossFadeProgress)) { if (lastPlayedClip.rootMotionEnabled) { return(res.GetMaterial(GPUSkinningPlayerResources.MaterialState.RootOn_BlendOn_CrossFadeRootOn)); } return(res.GetMaterial(GPUSkinningPlayerResources.MaterialState.RootOn_BlendOn_CrossFadeRootOff)); } return(res.GetMaterial(GPUSkinningPlayerResources.MaterialState.RootOn_BlendOff)); } if (res.IsCrossFadeBlending(lastPlayedClip, crossFadeTime, crossFadeProgress)) { if (lastPlayedClip.rootMotionEnabled) { return(res.GetMaterial(GPUSkinningPlayerResources.MaterialState.RootOff_BlendOn_CrossFadeRootOn)); } return(res.GetMaterial(GPUSkinningPlayerResources.MaterialState.RootOff_BlendOn_CrossFadeRootOff)); } else { return(res.GetMaterial(GPUSkinningPlayerResources.MaterialState.RootOff_BlendOff)); } }