Skip to content

Commit

Permalink
Update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nxrighthere committed Oct 7, 2020
1 parent 4c6dee7 commit aaf008c
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 38 deletions.
Binary file modified Content/Tests/Tests.umap
Binary file not shown.
78 changes: 40 additions & 38 deletions Source/Managed/Tests/VirtualReality.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,44 @@
using UnrealEngine.Framework;

namespace UnrealEngine.Tests {
public class VirtualReality : ISystem {
private Pawn pawnVR;
private SceneComponent body;
private MotionControllerComponent leftHand;
private MotionControllerComponent rightHand;

public VirtualReality() {
pawnVR = new("PawnVR");
body = new(pawnVR, "Root");
leftHand = new(pawnVR, "LeftHand");
rightHand = new(pawnVR, "RightHand");
}

public void OnBeginPlay() {
Camera mainCamera = World.GetActor<Camera>("MainCamera");

mainCamera.GetComponent<CameraComponent>().LockToHeadMountedDisplay = true;

PlayerController playerController = World.GetFirstPlayerController();

playerController.SetViewTarget(mainCamera);
playerController.Possess(pawnVR);

leftHand.DisplayDeviceModel = true;
leftHand.SetTrackingMotionSource("Left");

rightHand.DisplayDeviceModel = true;
rightHand.SetTrackingMotionSource("Right");
}

public void OnTick(float deltaTime) {
Debug.AddOnScreenMessage(1, 3.0f, Color.Yellow, "Head-mounted display is connected: " + HeadMountedDisplay.IsConnected);
Debug.AddOnScreenMessage(2, 3.0f, Color.Yellow, "Device enabled: " + HeadMountedDisplay.Enabled);
Debug.AddOnScreenMessage(3, 3.0f, Color.Yellow, "Device name: " + HeadMountedDisplay.DeviceName);
}

public void OnEndPlay() => Debug.ClearOnScreenMessages();
}
public class VirtualReality : ISystem {
private Pawn pawnVR;
private SceneComponent body;
private MotionControllerComponent leftHand;
private MotionControllerComponent rightHand;

public VirtualReality() {
pawnVR = new("PawnVR");
body = new(pawnVR, "Root");
leftHand = new(pawnVR, "LeftHand");
rightHand = new(pawnVR, "RightHand");
}

public void OnBeginPlay() {
Camera mainCamera = World.GetActor<Camera>("MainCamera");

mainCamera.GetComponent<CameraComponent>().LockToHeadMountedDisplay = true;

PlayerController playerController = World.GetFirstPlayerController();

playerController.SetViewTarget(mainCamera);
playerController.Possess(pawnVR);

leftHand.DisplayDeviceModel = true;
leftHand.SetTrackingMotionSource("Left");

rightHand.DisplayDeviceModel = true;
rightHand.SetTrackingMotionSource("Right");
}

public void OnTick(float deltaTime) {
Debug.AddOnScreenMessage(1, 3.0f, Color.Yellow, "Head-mounted display is connected: " + HeadMountedDisplay.IsConnected);
Debug.AddOnScreenMessage(2, 3.0f, Color.Yellow, "Device enabled: " + HeadMountedDisplay.Enabled);
Debug.AddOnScreenMessage(3, 3.0f, Color.Yellow, "Device name: " + HeadMountedDisplay.DeviceName);
Debug.AddOnScreenMessage(4, 3.0f, Color.Orange, "Left motion controller is tracked: " + leftHand.IsTracked);
Debug.AddOnScreenMessage(5, 3.0f, Color.Orange, "Right motion controller is tracked: " + rightHand.IsTracked);
}

public void OnEndPlay() => Debug.ClearOnScreenMessages();
}
}

0 comments on commit aaf008c

Please sign in to comment.