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


C# Urho.Node类代码示例

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


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

示例1: Init

		protected override async void Init()
		{
			var cache = Application.ResourceCache;
			var node = Node;
			var model = node.CreateComponent<StaticModel>();
			model.Model = cache.GetModel(Assets.Models.Player);
			var material = cache.GetMaterial(Assets.Materials.Player).Clone("");
			model.SetMaterial(material);

			node.SetScale(0.45f);
			node.Position = new Vector3(0f, -6f, 0f);
			node.Rotation = new Quaternion(-40, 0, 0);

			//TODO: rotor should be defined in the model + animation
			rotor = node.CreateChild();
			var rotorModel = rotor.CreateComponent<StaticModel>();
			rotorModel.Model = cache.GetModel(Assets.Models.Box);
			rotorModel.SetMaterial(cache.GetMaterial(Assets.Materials.Black));
			rotor.Scale = new Vector3(0.1f, 1.4f, 0.1f);
			rotor.Rotation = new Quaternion(0, 0, 0);
			rotor.Position = new Vector3(0, -0.15f, 1.2f);
			rotor.RunActionsAsync(new RepeatForever(new RotateBy(1f, 0, 0, 360f * 4))); //RPM

			// Load weapons
			node.AddComponent(new MachineGun());
			node.AddComponent(new Missile());

			await node.RunActionsAsync(new EaseOut(new MoveBy(0.5f, new Vector3(0, 3, 0)), 2));
			MoveRandomly();
		}
开发者ID:cianmulville,项目名称:urho-samples,代码行数:30,代码来源:Player.cs

示例2: ScaleByState

		public ScaleByState (ScaleTo action, Node target)
			: base (action, target)
		{ 
			DeltaX = StartScaleX * EndScaleX - StartScaleX;
			DeltaY = StartScaleY * EndScaleY - StartScaleY;
			DeltaZ = StartScaleZ * EndScaleZ - StartScaleZ;
		}
开发者ID:Zamir7,项目名称:urho,代码行数:7,代码来源:ScaleBy.cs

示例3: GetActionState

		public ActionState GetActionState(int tag, Node target)
		{
			Debug.Assert(tag != (int)ActionTag.Invalid);

			// Early out if we do not have any targets to search
			if (targets.Count == 0)
				return null;

			HashElement element;
			if (targets.TryGetValue(target, out element))
			{
				if (element.ActionStates != null)
				{
					int limit = element.ActionStates.Count;
					for (int i = 0; i < limit; i++)
					{
						var actionState = element.ActionStates[i];

						if (actionState.Action.Tag == tag)
						{
							return actionState;
						}
					}
				}
			}
			return null;
		}
开发者ID:Zamir7,项目名称:urho,代码行数:27,代码来源:ActionManager.cs

示例4: Start

		protected override void Start()
		{
			// base.Start() creates a basic scene
			base.Start();

			// Create a node for the Earth
			earthNode = Scene.CreateChild();
			earthNode.Position = new Vector3(0, 0, 1); // One meter away
			earthNode.SetScale(0.2f); // 20cm

			// Create a static model component - Sphere:
			var earth = earthNode.CreateComponent<Sphere>();
			// Materials are usually more complicated than just textures, but for such
			// simple cases we can use quick FromImage method to create a material from an image.
			earth.SetMaterial(Material.FromImage("Textures/Earth.jpg"));

			// Same steps for the Moon
			var moonNode = earthNode.CreateChild();
			moonNode.SetScale(0.27f); // Relative size of the Moon is 1738.1km/6378.1km
			moonNode.Position = new Vector3(1.2f, 0, 0);
			var moon = moonNode.CreateComponent<Sphere>();
			moon.SetMaterial(Material.FromImage("Textures/Moon.jpg"));

			// Run a an action to spin the Earth (5 degrees per second)
			earthNode.RunActions(new RepeatForever(new RotateBy(duration: 1f, deltaAngleX: 0, deltaAngleY: -5, deltaAngleZ: 0)));
		}
开发者ID:xamarin,项目名称:urho-samples,代码行数:26,代码来源:Program.cs

示例5: TintByState

		public TintByState (TintBy action, Node target)
			: base (action, target)
		{   
			DeltaB = action.DeltaB;
			DeltaG = action.DeltaG;
			DeltaR = action.DeltaR;

			staticSprite = Target.GetComponent<StaticSprite2D>();
			if (staticSprite != null)
			{
				var color = staticSprite.Color;
				FromR = color.R;
				FromG = color.G;
				FromB = color.B;
				return;
			}

			shape = Target.GetComponent<Shape>();
			if (shape != null)
			{
				FromR = shape.Color.R;
				FromG = shape.Color.G;
				FromB = shape.Color.B;
				return;
			}

			throw new NotSupportedException("The node should have StaticSprite2D or Shape component");
		}
开发者ID:Zamir7,项目名称:urho,代码行数:28,代码来源:TintBy.cs

示例6: OnHit

		public virtual void OnHit(Aircraft target, bool killed, Node bulletNode)
		{
			var body = bulletNode.GetComponent<RigidBody>();
			if (body != null)
				body.Enabled = false;
			bulletNode.SetScale(0);
		}
开发者ID:cianmulville,项目名称:urho-samples,代码行数:7,代码来源:Weapon.cs

示例7: Start

		protected override async void Start()
		{
			base.Start();
			clientConnection = new ClientConnection();
			clientConnection.Disconnected += ClientConnection_Disconnected;
			clientConnection.RegisterForRealtimeUpdate(GetCurrentPositionDto);
			clientConnection.RegisterFor<PointerPositionChangedDto>(OnClientPointerChanged);

			Zone.AmbientColor = new Color(0.3f, 0.3f, 0.3f);
			DirectionalLight.Brightness = 0.5f;

			environmentNode = Scene.CreateChild();
			EnableGestureTapped = true;

			cubeNode = environmentNode.CreateChild();
			cubeNode.SetScale(0.2f);
			cubeNode.Position = new Vector3(1000, 1000, 1000);
			var box = cubeNode.CreateComponent<Box>();
			box.Color = Color.White;

			var moveAction = new MoveBy(0.5f, new Vector3(0, 0.005f, 0));
			cubeNode.RunActions(new RepeatForever(new RotateBy(1f, 0, 120, 0)));
			cubeNode.RunActions(new RepeatForever(moveAction, moveAction.Reverse()));

			//material = Material.FromColor(Color.Gray); //-- debug mode
			material = Material.FromColor(Color.Transparent, true);

			await RegisterCortanaCommands(new Dictionary<string, Action> {
				{ "stop spatial mapping", StopSpatialMapping}
			});

			while (!await ConnectAsync()) { }
		}
开发者ID:xamarin,项目名称:urho-samples,代码行数:33,代码来源:ScannerApp.cs

示例8: OnExplode

		protected override void OnExplode(Node explodeNode)
		{
			rotor.RemoveAllActions();
			rotor.Remove();
			var particleEmitter = explodeNode.CreateComponent<ParticleEmitter2D>();
			explodeNode.SetScale(1.5f);
			particleEmitter.Effect = Application.ResourceCache.GetParticleEffect2D(Assets.Particles.PlayerExplosion);
		}
开发者ID:cianmulville,项目名称:urho-samples,代码行数:8,代码来源:Player.cs

示例9: OnHit

		public override void OnHit(Aircraft target, bool killed, Node bulletNode)
		{
			var soundSource = Node.CreateComponent<SoundSource>();
			soundSource.Gain = 0.1f;
			soundSource.Play(Application.ResourceCache.GetSound(Assets.Sounds.Powerup));
			base.OnHit(target, killed, bulletNode);
			((SamplyGame)Application).OnCoinCollected();
		}
开发者ID:cianmulville,项目名称:urho-samples,代码行数:8,代码来源:Coin.cs

示例10: TargetedActionState

		public TargetedActionState (TargetedAction action, Node target)
			: base (action, target)
		{   
			ForcedTarget = action.ForcedTarget;
			TargetedAction = action.Action;

			ActionState = (FiniteTimeActionState)TargetedAction.StartAction (ForcedTarget);
		}
开发者ID:Zamir7,项目名称:urho,代码行数:8,代码来源:TargetedAction.cs

示例11: RotateByState

		public RotateByState (RotateBy action, Node target)
			: base (action, target)
		{ 
			AngleX = action.AngleX;
			AngleY = action.AngleY;
			AngleZ = action.AngleZ;
			StartAngles = target.Rotation;
		}
开发者ID:Zamir7,项目名称:urho,代码行数:8,代码来源:RotateBy.cs

示例12: JumpByState

		public JumpByState (JumpBy action, Node target)
			: base (action, target)
		{ 
			Delta = action.Position;
			Height = action.Height;
			Jumps = action.Jumps;
			P = StartPosition = target.Position;
		}
开发者ID:Zamir7,项目名称:urho,代码行数:8,代码来源:JumpBy.cs

示例13: SequenceState

		public SequenceState (Sequence action, Node target)
			: base (action, target)
		{ 
			actionSequences = action.Actions;
			hasInfiniteAction = (actionSequences [0] is RepeatForever) || (actionSequences [1] is RepeatForever);
			split = actionSequences [0].Duration / Duration;
			last = -1;

		}
开发者ID:corefan,项目名称:urho,代码行数:9,代码来源:Sequence.cs

示例14: Launch

		async void Launch(Node bulletNode)
		{
			await bulletNode.RunActionsAsync(
				new MoveTo(3f, new Vector3(RandomHelper.NextRandom(-6f, 6f), -6, 0)),
				new CallFunc(() => bulletNode.SetScale(0f)));

			//remove the bullet from the scene.
			bulletNode.Remove();
		}
开发者ID:xamarin,项目名称:urho-samples,代码行数:9,代码来源:SmallPlate.cs

示例15: BezierToState

		public BezierToState (BezierBy action, Node target)
			: base (action, target)
		{ 
			var config = BezierConfig;

			config.ControlPoint1 -= StartPosition;
			config.ControlPoint2 -= StartPosition;
			config.EndPosition -= StartPosition;

			BezierConfig = config;
		}
开发者ID:Zamir7,项目名称:urho,代码行数:11,代码来源:BezierTo.cs


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