//Loop the img list
 private void LoopListCheck()
 {
     if (i >= GoList.Count - 1)
     {
         go     = GoList[i];
         nextgo = GoList[0];
     }
     else
     {
         go     = GoList[i];
         nextgo = GoList[i + 1];
     }
 }
Example #2
0
        private void CreateGoEntity(Transform goRoot, List <GoInfo> goInfos, List <Entity> entities, Vector2Int mapPos)
        {
            //默认都是先不激活状态
            Entity     entity  = null;
            GameObject childgo = null;

            for (int i = 0; i < goInfos.Count; i++)
            {
                GoInfo info = goInfos[i];
                childgo = goRoot.transform.GetChild(info.GoIndex).gameObject;
                entity  = ECSLocate.ECS.CreateEntity(info.GoEntityName, childgo);
                entity.Disable();
                entity.GetCom <SeekPathCom>().MapPos = mapPos;
                entities.Add(entity);
            }
        }
Example #3
0
        private List <GoInfo> GetGoInfos(Transform rootTrans)
        {
            List <GoInfo> list = new List <GoInfo>();

            for (int i = 0; i < rootTrans.childCount; i++)
            {
                GoInfo    info        = new GoInfo();
                Transform child       = rootTrans.GetChild(i);
                string    goAssetName = child.name;
                goAssetName.Replace("(", "(").Replace(")", ")");
                goAssetName = Regex.Replace(goAssetName.Replace("(", "(").Replace(")", ")"), @"\([^\(]*\)", "");

                info.GoEntityName = goAssetName;
                info.GoIndex      = i;
                info.Pos          = child.localPosition;
                list.Add(info);
                Debug.Log("资源名:" + goAssetName);
            }

            return(list);
        }
    private void Trans()
    {
        if (LoopTimes >= 1)
        {
            LoopListCheck();

            c     = go.curImg.color;
            nextc = go.curImg.color;

            if (Time.time < WaitUntil)//当前物体保持显形
            {
                Debug.Log("1");
                StillLife();
            }
            else
            {
                if (nextAlpha >= maxAlpha)//当前物体变现时
                {
                    Debug.Log("2");
                    if (i == GoList.Count - 1)
                    {
                        i = -1;
                    }
                    i++;

                    WaitUntil = Time.time + StillLifeTime; //设置新一轮时间限制
                    //设置数据为下一物体做准备
                    curAlpha  = 1;
                    nextAlpha = 0;
                }
                else//当前物体逐渐透明,下一物体逐渐现形
                {
                    Debug.Log("3");
                    FadeOut();

                    if (Time.time > WaitUntil + ImageReloadTime)
                    {
                        Debug.Log("4");
                        FadeIn();
                    }
                }

                if (curAlpha >= maxAlpha)//下一物体完全显形
                {
                    if (i == GoList.Count - 1)
                    {
                        LoopTimes--;
                    }
                }
            }
        }
        else
        {
            go = GoList[GoList.Count - 1];
            FadeOut();
            if (go.curImg.color.a == 0)
            {
                Kill(lib.gameObject);
            }
        }
    }