예제 #1
0
 /// <summary>
 /// 下一波敌人
 /// </summary>
 public void MoveNextTurn()
 {
     GLogger.Gray("MoveNextTurn--------->>>" + turnTeams.Count);
     if (turnTeams.Count == 0)
     {
         if (npcDataMgr.IsAllNpcStateOK(NpcType.Hero, NpcState.Attack))
         {
             timerMgr.AddTimer(0.5f, 0, (obj) =>
             {
                 GLogger.Cyan("MoveNextTurn.execOK-------------->>>>>");
                 if (execOK != null)
                 {
                     execOK();
                 }
             });
         }
     }
     else
     {
         this.SpawnNpcTeam();
         if (LogicConst.BattleType == BattleType.FreeBattle)
         {
             DoStartFight <FSearchState>(NpcType.Enemy);
         }
         else
         {
             DoStartFight <TSearchState>(NpcType.Enemy);
             battleFsm.GetGlobalVar <bool>("isTakeNewToken").value = true;
         }
     }
 }
예제 #2
0
        Vector3 FindBattlePos()
        {
            Vector3 currPos = embattlePosMgr.GetBattlePos();

            GLogger.Gray("Find Battle Pos::>" + currPos + " npcid:>" + mynpcId.value);

            var viewPortMargin = LogicConst.Viewport_Margin;

            if (myNpcData.npcType == NpcType.Hero)
            {
                var targetData = npcDataMgr.GetNpcData(targetId.value);
                if (targetData.position.x < myNpcData.position.x)
                {
                    currPos.x -= viewPortMargin / 1.5f - 0.6f;
                }
                else
                {
                    currPos.x += viewPortMargin / 1.5f - 0.6f;
                }
            }
            else
            {
                var v = myNpcData.faceDir == FaceDir.Left ? 1 : -1;
                currPos.x += v * viewPortMargin / 1.5f;
            }
            currPos.y = myNpcData.position.y;
            currPos.z = myNpcData.position.z;
            return(currPos);
        }
예제 #3
0
        IEnumerator OnLoadAssetBundle(string abName, Type type)
        {
            string url = GetAssetFullPath(abName);

            if (m_AssetBundleLoadingList.ContainsKey(url))
            {
                m_AssetBundleLoadingList[url]++;
                yield break;
            }
            m_AssetBundleLoadingList.Add(url, 1);
            GLogger.Gray(url);
            var abUrl   = Application.isEditor ? abName : url;
            var request = AssetBundle.LoadFromFileAsync(url);

            if (abName != AppConst.ResIndexFile)
            {
                string[] dependencies = m_AssetBundleManifest.GetAllDependencies(abName);
                if (dependencies.Length > 0)
                {
                    m_Dependencies.Add(abName, dependencies);
                    for (int i = 0; i < dependencies.Length; i++)
                    {
                        string          depName    = dependencies[i];
                        AssetBundleInfo bundleInfo = null;
                        if (m_LoadedAssetBundles.TryGetValue(depName, out bundleInfo))
                        {
                            bundleInfo.m_ReferencedCount++;
                        }
                        else if (!m_LoadRequests.ContainsKey(depName))
                        {
                            yield return(mResMgr.StartCoroutine(OnLoadAssetBundle(depName, type)));
                        }
                    }
                }
            }
            yield return(request);

            AssetBundle assetObj = request.assetBundle;

            if (assetObj != null)
            {
                var RefCount   = m_AssetBundleLoadingList[url];
                var bundleInfo = new AssetBundleInfo(assetObj, RefCount);
                m_LoadedAssetBundles.Add(abName, bundleInfo);
            }
            m_AssetBundleLoadingList.Remove(url);
        }
        /// <summary>
        /// 下一波敌人
        /// </summary>
        public void MoveNextTurn()
        {
            var teamCount = CurrHandler?.GetTeamCount();

            GLogger.Gray("MoveNextTurn--------->>>" + teamCount);
            if (teamCount == 0)
            {
                if (npcDataMgr.IsAllNpcStateOK(NpcType.Hero, NpcState.Attack))
                {
                    timerMgr.AddTimer(0.5f, 0, (obj) =>
                    {
                        if (execOK != null)
                        {
                            execOK();
                        }
                    });
                }
            }
            else
            {
                this.SpawnNpcTeam();
                CurrHandler?.MoveNextTurn();
            }
        }