From 2ae5b40ca6bb3d33310f0f66569bf150548a2de6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 24 Nov 2011 22:36:45 +0000 Subject: On pCampBot, add bot as a property on behaviours instead of passing it in every time --- .../Tools/pCampBot/Behaviours/PhysicsBehaviour.cs | 31 +++++++++++----------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs') diff --git a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs index 25529d0..daa7485 100644 --- a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs +++ b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs @@ -40,42 +40,41 @@ namespace pCampBot /// /// TODO: talkarray should be in a separate behaviour. /// - public class PhysicsBehaviour : IBehaviour + public class PhysicsBehaviour : AbstractBehaviour { - public string Name { get { return "Physics"; } } - private string[] talkarray; public PhysicsBehaviour() { + Name = "Physics"; talkarray = readexcuses(); } - public void Action(Bot bot) + public override void Action() { - int walkorrun = bot.Random.Next(4); // Randomize between walking and running. The greater this number, + int walkorrun = Bot.Random.Next(4); // Randomize between walking and running. The greater this number, // the greater the bot's chances to walk instead of run. - bot.Client.Self.Jump(false); + Bot.Client.Self.Jump(false); if (walkorrun == 0) { - bot.Client.Self.Movement.AlwaysRun = true; + Bot.Client.Self.Movement.AlwaysRun = true; } else { - bot.Client.Self.Movement.AlwaysRun = false; + Bot.Client.Self.Movement.AlwaysRun = false; } // TODO: unused: Vector3 pos = client.Self.SimPosition; - Vector3 newpos = new Vector3(bot.Random.Next(1, 254), bot.Random.Next(1, 254), bot.Random.Next(1, 254)); - bot.Client.Self.Movement.TurnToward(newpos); + Vector3 newpos = new Vector3(Bot.Random.Next(1, 254), Bot.Random.Next(1, 254), Bot.Random.Next(1, 254)); + Bot.Client.Self.Movement.TurnToward(newpos); - bot.Client.Self.Movement.AtPos = true; - Thread.Sleep(bot.Random.Next(3000, 13000)); - bot.Client.Self.Movement.AtPos = false; - bot.Client.Self.Jump(true); - string randomf = talkarray[bot.Random.Next(talkarray.Length)]; + Bot.Client.Self.Movement.AtPos = true; + Thread.Sleep(Bot.Random.Next(3000, 13000)); + Bot.Client.Self.Movement.AtPos = false; + Bot.Client.Self.Jump(true); + string randomf = talkarray[Bot.Random.Next(talkarray.Length)]; if (talkarray.Length > 1 && randomf.Length > 1) - bot.Client.Self.Chat(randomf, 0, ChatType.Normal); + Bot.Client.Self.Chat(randomf, 0, ChatType.Normal); } private string[] readexcuses() -- cgit v1.1