forked from chomp/BotGenerator
pass working path to class
pass a list of bot files to difficulty helper
This commit is contained in:
parent
b998737998
commit
1b22e9d01b
@ -5,6 +5,7 @@ using Generator.Models.Output;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace Generator
|
||||
@ -12,10 +13,12 @@ namespace Generator
|
||||
public class BaseBotGenerator
|
||||
{
|
||||
private readonly List<Datum> _rawParsedBots;
|
||||
private readonly string _workingPath;
|
||||
|
||||
public BaseBotGenerator(List<Datum> parsedBots)
|
||||
public BaseBotGenerator(List<Datum> parsedBots, string workingPath)
|
||||
{
|
||||
_rawParsedBots = parsedBots;
|
||||
_workingPath = workingPath;
|
||||
}
|
||||
|
||||
public List<Bot> AddBaseDetails()
|
||||
@ -40,7 +43,7 @@ namespace Generator
|
||||
.Where(x => string.Equals(x.Info.Settings.Role, botToUpdate.botType.ToString(), StringComparison.OrdinalIgnoreCase)).ToList();
|
||||
|
||||
UpdateBodyPartHealth(botToUpdate, rawBotsOfSameType);
|
||||
AddDifficulties(botToUpdate, rawBotsOfSameType);
|
||||
AddDifficulties(botToUpdate, _workingPath);
|
||||
|
||||
foreach (var rawParsedBot in rawBotsOfSameType)
|
||||
{
|
||||
@ -61,20 +64,14 @@ namespace Generator
|
||||
bot.appearance.voice.AddUnique(rawParsedBot.Info.Voice);
|
||||
}
|
||||
|
||||
private void AddDifficulties(Bot bot, List<Datum> rawParsedBots)
|
||||
private void AddDifficulties(Bot bot, string workingPath)
|
||||
{
|
||||
switch (bot.botType)
|
||||
{
|
||||
case BotType.assault:
|
||||
DifficultyHelper.AddAssaultDifficulties(bot);
|
||||
break;
|
||||
case BotType.pmcBot:
|
||||
break;
|
||||
case BotType.marksman:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
var botFiles = Directory
|
||||
.GetFiles($"{workingPath}//Assets", "*.txt", SearchOption.TopDirectoryOnly)
|
||||
.Where(x => x.Contains(bot.botType.ToString()))
|
||||
.ToList();
|
||||
|
||||
DifficultyHelper.AddDifficultySettings(bot, botFiles);
|
||||
}
|
||||
|
||||
private void UpdateBodyPartHealth(Bot botToUpdate, List<Datum> rawParsedBots)
|
||||
|
@ -23,7 +23,7 @@ namespace Generator
|
||||
}
|
||||
|
||||
// Generate the base bot class and add basic details (health/body part hp etc)
|
||||
var baseBotGenerator = new BaseBotGenerator(parsedBots);
|
||||
var baseBotGenerator = new BaseBotGenerator(parsedBots, workingPath);
|
||||
var baseBots = baseBotGenerator.AddBaseDetails();
|
||||
|
||||
// Add weapons/armor to bot
|
||||
|
Loading…
x
Reference in New Issue
Block a user