示例#1
0
 //播放默认动画
 protected void PlayDefaultAnim()
 {
     if (m_defaultAnim == null)
     {
         CGlobalUtil.Log("CAnimBase: 默认动画为空");
         return;
     }
     m_curAnim       = m_defaultName;
     m_curAnimSprite = m_defaultAnim;
     m_isLoop        = true;
     m_frame         = 0;
 }
示例#2
0
 //资源加载
 public Object LoadObject(string pathName, string resName, string bagName = "")
 {
     if (IsLoadAssetBundle)
     {
         return(CAssetBundleManager.Instance.LuaLoadAssetBundle(pathName, bagName, resName));
     }
     else
     {
         //通过路径加载资源
         Object go = Resources.Load <Object>(pathName + "/" + resName);
         if (go == null)
         {
             CGlobalUtil.Log("CResLoadMgr: Resources加载路径加载失败");
             return(null);
         }
         return(go);
     }
 }
示例#3
0
 //预设体加载
 public GameObject LoadPrefab(string pathName, string resName, string bagName = "")
 {
     if (IsLoadAssetBundle)
     {
         return(Instantiate(CAssetBundleManager.Instance.LuaLoadAssetBundle(pathName, bagName, resName) as GameObject));
     }
     else
     {
         //通过路径加载预设体
         GameObject go = Resources.Load <GameObject>(pathName + "/" + resName);
         if (go == null)
         {
             CGlobalUtil.Log("CResLoadMgr: Resources加载路径加载失败");
             return(null);
         }
         return(Instantiate(go));
     }
 }
示例#4
0
 protected virtual void Update()
 {
     m_clock += Time.deltaTime;
     if (m_clock > m_fps)
     {
         m_clock = 0.0f;
         if (m_frame >= m_curAnimSprite.Length)
         {
             if (m_isLoop)
             {
                 m_frame = 0;
             }
             else if (m_isDefault)
             {
                 if (m_defaultAnim == null)
                 {
                     CGlobalUtil.Log("CAnimBase: 默认动画为空");
                     return;
                 }
                 m_curAnim       = m_defaultName;
                 m_curAnimSprite = m_defaultAnim;
                 m_isLoop        = true;
                 m_frame         = 0;
             }
             else
             {
                 m_frame = -1;
             }
             m_isForced = false;
         }
         if (m_frame != -1)
         {
             m_sr.sprite = m_curAnimSprite[m_frame++];
         }
     }
 }