Ejemplo n.º 1
0
        public static Bot SpawnBot(
            BotType botType,
            BotFaction faction     = BotFaction.None,
            IPlayer player         = null,
            PlayerTeam team        = BotTeam,
            bool ignoreFullSpawner = false,
            bool triggerOnSpawn    = true)
        {
            if (player == null)
            {
                player = SpawnPlayer(ignoreFullSpawner);
            }
            if (player == null)
            {
                return(null);
            }

            player.SetTeam(team);

            var bot       = BotFactory.Create(player, botType, faction);
            var info      = bot.Info;
            var weaponSet = WeaponSet.Empty;

            if (RandomHelper.Percentage(info.EquipWeaponChance))
            {
                weaponSet = RandomHelper.GetItem(GetWeapons(botType));
            }
            BotHelper.Equip(player, weaponSet);

            var profile = RandomHelper.GetItem(GetProfiles(botType));

            player.SetProfile(profile);
            if (player.Name == "COM")
            {
                player.SetBotName(profile.Name);
            }

            var behaviorSet = GetBehaviorSet(info.AIType);

            behaviorSet.SearchItems     = info.SearchItems;
            behaviorSet.SearchItemRange = info.SearchRange;

            bot.SetBotBehaviorSet(behaviorSet, true);
            player.SetModifiers(info.Modifiers);
            player.SetBotBehaviorActive(true);

            m_bots[player.UniqueID] = bot; // This may be updated if using setplayer command

            if (triggerOnSpawn)
            {
                TriggerOnSpawn(bot);
            }

            return(bot);
        }
Ejemplo n.º 2
0
 public Round(
     int number,
     IBotFactory botFactory,
     ISettings settings,
     ITurnFactory turnFactory,
     IBattlefieldFactory battlefieldFactory)
 {
     Number             = number;
     BotFactory         = botFactory ?? throw new ArgumentNullException(nameof(botFactory));
     Settings           = settings ?? throw new ArgumentNullException(nameof(settings));
     TurnFactory        = turnFactory ?? throw new ArgumentNullException(nameof(turnFactory));
     BattlefieldFactory = battlefieldFactory ?? throw new ArgumentNullException(nameof(battlefieldFactory));
     Battlefield        = BattlefieldFactory.Create();
     Bots = BotFactory.Create(Battlefield);
     Battlefield.SetRandomly(Bots);
 }
Ejemplo n.º 3
0
        public DialogFlowResponse Post(int eventId, [FromBody] DialogFlowRequest request)
        {
            var bot = BotFactory.Create(eventId);

            return(bot.GetResponse(request));
        }