Beispiel #1
0
		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()) { }
		}
Beispiel #2
0
		async void MoveRandomly()
		{
			while (IsAlive)
			{
				var moveAction = new MoveBy(0.75f, new Vector3(RandomHelper.NextRandom(-0.4f, 0.4f), RandomHelper.NextRandom(-0.3f, 0.3f), 0));
				await Node.RunActionsAsync(moveAction, moveAction.Reverse());
			}
		}
Beispiel #3
0
		/// <summary>
		/// Set boundaries for random movements
		/// </summary>
		protected async void MoveRandomly(float minX, float maxX, float minY, float maxY, float duration)
		{
			while (IsAlive)
			{
				var moveAction = new MoveBy(duration, new Vector3(RandomHelper.NextRandom(minX, maxX), RandomHelper.NextRandom(minY, maxY), 0));
				await Node.RunActionsAsync(moveAction, moveAction.Reverse());
			}
		}
Beispiel #4
0
		public override void OnAttachedToNode(Node node)
		{
			base.OnAttachedToNode(node);
			Application.Input.TouchEnd += Input_TouchEnd;
			Application.Input.TouchBegin += Input_TouchBegin;

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

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

			camera = Scene.GetChildrenWithComponent<Camera>(true).First().GetComponent<Camera>();
			octree = Scene.GetComponent<Octree>(true);
		}