Exemple #1
0
		static void Test2 (CharacterInfo characterInfo, NodeWalker walker, Stopwatch timer)
		{
			characterInfo.Input.MoveStick.X = -0.5f;
			characterInfo.Input.MoveStick.Y = -0.5f;
			characterInfo.Input.AttackStick.X = 0.0f;
			characterInfo.Input.AttackStick.Y = 0.0f;
			timer.Reset ();
			for (int i = 0; i < MAX_TIMES; ++i)
			{
				timer.Start ();
				walker.Restart ();
				walker.ComputeAllSteps ();
				timer.Stop ();
			}
			System.Console.WriteLine ("Time elapsed : " + timer.Elapsed.TotalMilliseconds / MAX_TIMES);
			System.Console.WriteLine ("walker.IsComplete : " + walker.IsComplete);
			System.Console.WriteLine ("walker.Outcome : " + walker.Outcome);
			System.Console.WriteLine ("IsMoving : " + characterInfo.Current.IsMoving);
			System.Console.WriteLine ("IsGuardUp : " + characterInfo.Current.IsGuardUp);
		}
Exemple #2
0
		public static void Main (string[] args)
		{
			System.Console.WriteLine ("Hello World!");

			var characterInfo = new CharacterInfo();

			characterInfo.Input = new Brawler.Input.Packets.ControllerState();
			characterInfo.Input.AttackStick = new Brawler.Input.Packets.AnalogStick();
			characterInfo.Input.MoveStick = new Brawler.Input.Packets.AnalogStick();

			characterInfo.Current = new Brawler.Simulation.PlayerInfo();
			characterInfo.Previous = new Brawler.Simulation.PlayerInfo();

			var dictionary = new TreeDictionary();

			var builder = new BlackboardTreeBuilder<CharacterInfo>(
				new TreeBuilder(),
				dictionary);

			var plan = builder
					.Selector()
					.Begin ()
						//.Success()
						.Failed ()
						.Success()
						.Success()
					.End ();
					
			var compiled = builder.Build();
			//var compiled = BuildSM (builder);
		
			var walker = new NodeWalker(compiled);
			walker.Restart ();
			walker.ComputeStep();
			System.Console.WriteLine ("walker.IsComplete : " + walker.IsComplete);
			System.Console.WriteLine ("walker.Outcome : " + walker.Outcome);
			walker.ComputeStep();
			System.Console.WriteLine ("walker.IsComplete : " + walker.IsComplete);
			System.Console.WriteLine ("walker.Outcome : " + walker.Outcome);
			walker.ComputeStep();
			System.Console.WriteLine ("walker.IsComplete : " + walker.IsComplete);
			System.Console.WriteLine ("walker.Outcome : " + walker.Outcome);
			walker.ComputeStep();
			System.Console.WriteLine ("walker.IsComplete : " + walker.IsComplete);
			System.Console.WriteLine ("walker.Outcome : " + walker.Outcome);
			walker.ComputeStep();
			System.Console.WriteLine ("walker.IsComplete : " + walker.IsComplete);
			System.Console.WriteLine ("walker.Outcome : " + walker.Outcome);
			walker.ComputeStep();
			System.Console.WriteLine ("walker.IsComplete : " + walker.IsComplete);
			System.Console.WriteLine ("walker.Outcome : " + walker.Outcome);
			//Test1 (characterInfo, walker);

			//Test2 (characterInfo, walker, timer, MAX_TIMES);
		}