Пример #1
0
		public void CreateDefaultInputCommandsIfContentNotFound()
		{
			var inputCommands = ContentLoader.Load<NotExistingInputCommands>("NotExistingInputCommands");
			inputCommands.InternalCreateDefault();
			var exitCommand = new Command(Command.Exit, (Action)null);
			List<Trigger> triggers = exitCommand.GetTriggers();
			Assert.AreEqual(1, triggers.Count);
			Assert.AreEqual("KeyTrigger", triggers[0].GetShortNameOrFullNameIfNotFound());
		}
Пример #2
0
		private void CreateGameCamera(float minZoom, float maxZoom, float zoomSmoothingFactor)
		{
			orthoCamera = Camera.Use<OrthoCamera>();
			orthoCamera.Position = new Vector3D(transformedPosition, CameraHeight);
			orthoCamera.MinZoom = minZoom;
			orthoCamera.MaxZoom = maxZoom;
			orthoCamera.ZoomSmoothFactor = zoomSmoothingFactor;
			orthoCamera.ZoomLevel = minZoom;
			moveCommand = new Command(GameCommands.ViewPanning.ToString(), MoveCameraByMouse);
			zoomCommand = new Command(GameCommands.ViewZooming.ToString(), orthoCamera.Zoom);
			turnRightCommand = new Command(GameCommands.TurnViewRight.ToString(), TurnRight);
			turnLeftCommand = new Command(GameCommands.TurnViewLeft.ToString(), TurnLeft);
		}
Пример #3
0
		public void TestPausable()
		{
			var command = new Command(() => { });
			Assert.IsFalse(command.IsPauseable);
		}
Пример #4
0
		public void RegisterCommandWithSeveralTriggers()
		{
			const string CommandName = "CommandWithSeveralTriggers";
			var trigger1 = new MockTrigger();
			var trigger2 = new MockTrigger();
			Command.Register(CommandName, trigger1, trigger2);
			var command = new Command(CommandName, (Action)null);
			Assert.AreEqual(2, command.GetTriggers().Count);
		}