Separate out physics testing actions into a separate PhysicsBehaviour class

This commit is contained in:
Justin Clark-Casey (justincc)
2011-11-03 21:16:24 +00:00
parent a62ccb5c4c
commit 66c60c56a0
5 changed files with 220 additions and 94 deletions

View File

@@ -37,6 +37,7 @@ using log4net.Repository;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Console;
using pCampBot.Interfaces;
namespace pCampBot
{
@@ -119,10 +120,14 @@ namespace pCampBot
string password = cs.GetString("password");
string loginUri = cs.GetString("loginuri");
// Hardcoded for new
List<IBehaviour> behaviours = new List<IBehaviour>();
behaviours.Add(new PhysicsBehaviour());
for (int i = 0; i < botcount; i++)
{
string lastName = string.Format("{0}_{1}", lastNameStem, i);
startupBot(i, this, firstName, lastName, password, loginUri);
startupBot(i, this, behaviours, firstName, lastName, password, loginUri);
}
}
@@ -150,14 +155,17 @@ namespace pCampBot
/// This starts up the bot and stores the thread for the bot in the thread array
/// </summary>
/// <param name="pos">The position in the thread array to stick the bot's thread</param>
/// <param name="cs">Configuration of the bot</param>
/// <param name="bm"></param>
/// <param name="behaviours">Behaviours for this bot to perform.</param>
/// <param name="firstName">First name</param>
/// <param name="lastName">Last name</param>
/// <param name="password">Password</param>
/// <param name="loginUri">Login URI</param>
public void startupBot(int pos, BotManager bm, string firstName, string lastName, string password, string loginUri)
public void startupBot(
int pos, BotManager bm, List<IBehaviour> behaviours,
string firstName, string lastName, string password, string loginUri)
{
PhysicsBot pb = new PhysicsBot(bm, firstName, lastName, password, loginUri);
PhysicsBot pb = new PhysicsBot(bm, behaviours, firstName, lastName, password, loginUri);
pb.OnConnected += handlebotEvent;
pb.OnDisconnected += handlebotEvent;