示例#1
0
        private IEnumerator RunTest()
        {
            //创建战斗(数据)
            singleBattle = BattleFieldCreator.Instance.Create(
                mapSize.x, mapSize.y,
                obstacleCount, obstacleGap, buffCount, itemCount,
                teamA, teamB);

            for (int i = 0; i < battleTestCount; ++i)
            {
#if UNITY_EDITOR
                UnityEditor.EditorUtility.DisplayProgressBar("战斗计算", string.Format("战斗场次计算进度 {0}/{1}", i + 1, battleTestCount), (i + 1) * 1f / battleTestCount);
#endif

                singleBattle.ResetBattle();

                singleBattle.Run();

                //如果运算出现问题,播放一下有问题的场
                if (singleBattle.battleState == BattleState.Exception)
                {
                    singleBattle.ConnectRenderer(BattleFieldRenderer.Instance);
                    BattleFieldRenderer.Instance.PlayBattle(null);
                    yield return(EGameConstL.WaitForTouchScreen);
                }

                yield return(null);
            }
#if UNITY_EDITOR
            UnityEditor.EditorUtility.ClearProgressBar();
#endif
        }
示例#2
0
        private IEnumerator RunTest()
        {
            for (int i = 0; i < testCount; ++i)
            {
#if UNITY_EDITOR
                UnityEditor.EditorUtility.DisplayProgressBar("战斗计算", string.Format("战斗场次计算进度 {0}/{1}", i + 1, testCount), (i + 1) * 1f / testCount);
#endif
                //创建战斗(数据)
                singleBattle = BattleCreator.Instance.CreateBattle(
                    mapSize.x, mapSize.y,
                    obstacleCount, obstacleGap,
                    battleUnitCount);

                var state = singleBattle.Run(true);

                //如果运算出现问题,播放一下有问题的场
                if (state == -1)
                {
                    singleBattle.ConnectRenderer(BattleFieldRenderer.Instance);
                    yield return(BattleFieldRenderer.Instance.PlayBattleActions());

                    yield return(EGameConstL.WaitForTouchScreen);
                }

                yield return(null);
            }
#if UNITY_EDITOR
            UnityEditor.EditorUtility.ClearProgressBar();
#endif
        }
示例#3
0
 public void ResetBattleField()
 {
     StopAllCoroutines();
     battleField.ResetBattle();
     currentActionIndex = 0;
     SetCircularRangeRenderStateActive(false, GridRenderType.SkillEffectRange);
     SetGridsRenderStateActive(false);
     battleField.Run();
 }
示例#4
0
        public void RunManualTest()
        {
            //创建战斗(数据)
            singleBattle = BattleFieldCreator.Instance.Create(
                mapSize.x, mapSize.y,
                obstacleCount, obstacleGap, buffCount, itemCount,
                teamA, teamB);

            //重置相机和尺寸
            ResetBattleCamera();

            singleBattle.ConnectRenderer(BattleFieldRenderer.Instance);

            singleBattle.Run();
        }
示例#5
0
        private void RunManualTest()
        {
            //创建战斗(数据)
            singleBattle = BattleCreator.Instance.CreateBattle(
                mapSize.x, mapSize.y,
                obstacleCount, obstacleGap,
                battleUnitCount);

            //重置相机和尺寸
            ResetBattleCamera();

            singleBattle.ConnectRenderer(BattleFieldRenderer.Instance);

            singleBattle.Run();
        }
示例#6
0
        private void OnGUI()
        {
            if (!battleFiledRendererIsReady)
            {
                return;
            }

            if (singleBattle == null)
            {
                if (GUI.Button(new Rect(0, 0, 150, 100), "Create battle"))
                {
                    if (testCount > 0)
                    {
                        StartCoroutine(RunTest());
                        return;
                    }
                    //创建战斗(数据)
                    singleBattle = BattleCreator.Instance.CreateBattle(
                        mapSize.x, mapSize.y,
                        obstacleCount, obstacleGap,
                        battleUnitCount);

                    //重置相机和尺寸
                    ResetBattleCamera();

                    //战斗计算(保留战斗过程)
                    singleBattle.Run(true);

                    //连接到显示器
                    singleBattle.ConnectRenderer(BattleFieldRenderer.Instance);

                    //显示战斗过程
                    StartCoroutine(BattleFieldRenderer.Instance.PlayBattleActions());
                }
            }
        }