On pCampBot, add bot as a property on behaviours instead of passing it in every time

This commit is contained in:
Justin Clark-Casey (justincc)
2011-11-24 22:36:45 +00:00
parent cbbd992df4
commit 2ae5b40ca6
7 changed files with 115 additions and 56 deletions

View File

@@ -151,29 +151,29 @@ namespace pCampBot
Array.ForEach<string>(
cs.GetString("behaviours", "p").Split(new char[] { ',' }), b => behaviourSwitches.Add(b));
List<IBehaviour> behaviours = new List<IBehaviour>();
// Hard-coded for now
if (behaviourSwitches.Contains("p"))
behaviours.Add(new PhysicsBehaviour());
if (behaviourSwitches.Contains("g"))
behaviours.Add(new GrabbingBehaviour());
if (behaviourSwitches.Contains("t"))
behaviours.Add(new TeleportBehaviour());
// if (behaviourSwitches.Contains("c"))
// behaviours.Add(new CrossBehaviour());
MainConsole.Instance.OutputFormat(
"[BOT MANAGER]: Bots configured for behaviours {0}",
string.Join(",", behaviours.ConvertAll<string>(b => b.Name).ToArray()));
for (int i = 0; i < botcount; i++)
{
string lastName = string.Format("{0}_{1}", lastNameStem, i);
List<IBehaviour> behaviours = new List<IBehaviour>();
// Hard-coded for now
if (behaviourSwitches.Contains("p"))
behaviours.Add(new PhysicsBehaviour());
if (behaviourSwitches.Contains("g"))
behaviours.Add(new GrabbingBehaviour());
if (behaviourSwitches.Contains("t"))
behaviours.Add(new TeleportBehaviour());
if (behaviourSwitches.Contains("c"))
behaviours.Add(new CrossBehaviour());
MainConsole.Instance.OutputFormat(
"[BOT MANAGER]: Bot {0} {1} configured for behaviours {2}",
firstName, lastName, string.Join(",", behaviours.ConvertAll<string>(b => b.Name).ToArray()));
StartBot(this, behaviours, firstName, lastName, password, loginUri);
}
}