Ejemplo n.º 1
0
 private void TimerProc()
 {
     while (true)
     {
         roundMark++;
         if (roundMark % 2 == 0)
         {
             BattleManager.Instance.MonsterQueue.NextAction(0.01f);
             if (BattleManager.Instance.MonsterQueue.LeftCount == 0 || BattleManager.Instance.MonsterQueue.RightCount == 0)
             {
                 EndGame();
                 break;
             }
         }
         if (roundMark % 4 == 0)
         {
             float pastTime = (float)200 / GameConstants.RoundTime;
             BattleManager.Instance.PlayerManager.Update(false, pastTime, BattleManager.Instance.StatisticData.Round);
             if (roundMark % 250 == 0)
             {
                 BattleManager.Instance.PlayerManager.CheckRoundCard();
             }
         }
         if (roundMark % 10 == 0)
         {
             AIStrategy.AIProc(BattleManager.Instance.PlayerManager.RightPlayer);
             AIStrategy.AIProc(BattleManager.Instance.PlayerManager.LeftPlayer);
         }
         BattleManager.Instance.StatisticData.Round = roundMark * 50 / GameConstants.RoundTime + 1;//50ms
     }
 }
Ejemplo n.º 2
0
        private void StartGame() //初始化游戏
        {
            AIStrategy.OnInit(BattleManager.Instance.PlayerManager.RightPlayer);

            BattleManager.Instance.StatisticData.StartTime = DateTime.Now;
            BattleManager.Instance.StatisticData.EndTime   = DateTime.Now;

            cardsArray1.Visible   = true;
            miniItemView1.Visible = true;
            vRegion.Visible       = true;
            IsGamePaused          = false;

            Invalidate();
        }