Exemplo n.º 1
0
        private void DoBotAction(Bot bot)
        {
            if (!bot.CanAct)
            {
                return;
            }

            if (bot.BotMode == PracticeMode.Passive)
            {
                return;
            }

            bot.UpdateAct();
            Field field = bot.InGameID == 1 ? bot.CurrentMatch.Field1 : bot.CurrentMatch.Field2;

            Swap swap = fieldManager.GetAllPossibleSwaps(field).FirstOrDefault();

            if (swap.Equals(default(Swap)))
            {
                // No possible turns
                return;
            }

            BlockSwapRequest request = new BlockSwapRequest
            {
                X         = swap.X,
                Y         = swap.Y,
                Direction = swap.Direction,
            };

            GameCore.Instance.ProcessBlockSwap(bot, request);
        }