当前位置: 首页>>代码示例>>C#>>正文


C# Node.Rotate方法代码示例

本文整理汇总了C#中Urho.Node.Rotate方法的典型用法代码示例。如果您正苦于以下问题:C# Node.Rotate方法的具体用法?C# Node.Rotate怎么用?C# Node.Rotate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Urho.Node的用法示例。


在下文中一共展示了Node.Rotate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowStartMenu

		public async Task ShowStartMenu(bool gameOver)
		{
			var cache = Application.ResourceCache;
			bigAircraft = Node.CreateChild();
			var model = bigAircraft.CreateComponent<StaticModel>();

			if (gameOver)
			{
				model.Model = cache.GetModel(Assets.Models.Enemy1);
				model.SetMaterial(cache.GetMaterial(Assets.Materials.Enemy1).Clone(""));
				bigAircraft.SetScale(0.3f);
				bigAircraft.Rotate(new Quaternion(180, 90, 20), TransformSpace.Local);
			}
			else
			{
				model.Model = cache.GetModel(Assets.Models.Player);
				model.SetMaterial(cache.GetMaterial(Assets.Materials.Player).Clone(""));
				bigAircraft.SetScale(1f);
				bigAircraft.Rotate(new Quaternion(0, 40, -50), TransformSpace.Local);
			}

			bigAircraft.Position = new Vector3(10, 2, 10);
			bigAircraft.RunActions(new RepeatForever(new Sequence(new RotateBy(1f, 0f, 0f, 5f), new RotateBy(1f, 0f, 0f, -5f))));

			//TODO: rotor should be defined in the model + animation
			rotor = bigAircraft.CreateChild();
			var rotorModel = rotor.CreateComponent<Box>();
			rotorModel.Color = Color.White;
			rotor.Scale = new Vector3(0.1f, 1.5f, 0.1f);
			rotor.Position = new Vector3(0, 0, -1.3f);
			var rotorAction = new RepeatForever(new RotateBy(1f, 0, 0, 360f*6)); //RPM
			rotor.RunActions(rotorAction);
			
			menuLight = bigAircraft.CreateChild();
			menuLight.Position = new Vector3(-3, 6, 2);
			menuLight.AddComponent(new Light { LightType = LightType.Point, Brightness = 0.3f });

			await bigAircraft.RunActionsAsync(new EaseIn(new MoveBy(1f, new Vector3(-10, -2, -10)), 2));

			textBlock = new Text();
			textBlock.HorizontalAlignment = HorizontalAlignment.Center;
			textBlock.VerticalAlignment = VerticalAlignment.Bottom;
			textBlock.Value = gameOver ? "GAME OVER" : "TAP TO START";
			textBlock.SetFont(cache.GetFont(Assets.Fonts.Font), Application.Graphics.Width / 15);
			Application.UI.Root.AddChild(textBlock);

			menuTaskSource = new TaskCompletionSource<bool>();
			finished = false;
			await menuTaskSource.Task;
		}
开发者ID:xamarin,项目名称:urho-samples,代码行数:50,代码来源:StartMenu.cs

示例2: OnAttachedToNode

		public override void OnAttachedToNode(Node node)
		{
			barNode = node.CreateChild();
			barNode.Scale = new Vector3(1, 0, 1); //means zero height
			var box = barNode.CreateComponent<Box>();
			box.Color = color;

			textNode = node.CreateChild();
			textNode.Rotate(new Quaternion(0, 180, 0), TransformSpace.World);
			textNode.Position = new Vector3(0, 10, 0);
			text3D = textNode.CreateComponent<Text3D>();
			text3D.SetFont(Application.ResourceCache.GetFont("Fonts/Anonymous Pro.ttf"), 60);
			text3D.TextEffect = TextEffect.Stroke;
			//textNode.LookAt() //Look at camera

			base.OnAttachedToNode(node);
		}
开发者ID:cianmulville,项目名称:urho-samples,代码行数:17,代码来源:Charts.cs


注:本文中的Urho.Node.Rotate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。