Prove released authoritative aim and camera channels
This commit is contained in:
parent
58d87c628a
commit
68aba5f67b
5 changed files with 66 additions and 26 deletions
|
|
@ -188,6 +188,7 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
EveUnityPlayableWorldClientHost host = null;
|
||||
EveUnityPlayableWorldRuntime runtime = null;
|
||||
WitnessReceipt movementReceipt = null;
|
||||
WitnessReceipt lookReceipt = null;
|
||||
WitnessReceipt focusReceipt = null;
|
||||
WitnessReceipt actionReceipt = null;
|
||||
EveUnityShotReceipt observedShot = null;
|
||||
|
|
@ -196,6 +197,7 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
float hullRatioBefore = 0f;
|
||||
long initialVersion = 0;
|
||||
float movementDistance = 0f;
|
||||
float aimDotDistance = 0f;
|
||||
|
||||
try
|
||||
{
|
||||
|
|
@ -344,18 +346,24 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
aim.y = 0;
|
||||
Assert.That(aim.sqrMagnitude, Is.GreaterThan(0.0001f));
|
||||
aim.Normalize();
|
||||
var steerVersion = runtime.ActiveVersion;
|
||||
var steer = runtime.SubmitMoveVectorIntent(playerId, aim.x, aim.z, 0.25f);
|
||||
var steerDeadline = Time.realtimeSinceStartup + 12f;
|
||||
while (Time.realtimeSinceStartup < steerDeadline &&
|
||||
(runtime.LastReceipt == null || runtime.LastReceipt.CommandId != steer.CommandId ||
|
||||
!string.Equals(runtime.LastReceipt.State, "reconciled", StringComparison.OrdinalIgnoreCase)))
|
||||
var lookVersion = runtime.ActiveVersion;
|
||||
var look = runtime.SubmitLookDirectionIntent(playerId, aim.x, 0f, aim.z);
|
||||
var lookDeadline = Time.realtimeSinceStartup + 12f;
|
||||
while (Time.realtimeSinceStartup < lookDeadline &&
|
||||
(runtime.LastReceipt == null || runtime.LastReceipt.CommandId != look.CommandId ||
|
||||
!string.Equals(runtime.LastReceipt.State, "reconciled", StringComparison.OrdinalIgnoreCase) ||
|
||||
runtime.ActiveVersion < runtime.LastReceipt.SourceVersion ||
|
||||
Vector3.Dot(FindMarker(root, playerId).transform.forward, aim) < 0.99f))
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(0.1f);
|
||||
runtime.Refresh();
|
||||
}
|
||||
AssertReconciledProviderReceipt(runtime.LastReceipt, steer.CommandId,
|
||||
provider.Selection.ProviderId, provider.Selection.SurfaceId, steerVersion);
|
||||
AssertReconciledProviderReceipt(runtime.LastReceipt, look.CommandId,
|
||||
provider.Selection.ProviderId, provider.Selection.SurfaceId, lookVersion);
|
||||
Assert.That(Vector3.Dot(FindMarker(root, playerId).transform.forward, aim), Is.GreaterThan(0.99f));
|
||||
lookReceipt = WitnessReceipt.From("look", runtime.LastReceipt);
|
||||
var aimRenderer = root.GetComponent<EveUnityAimPresentationRenderer>();
|
||||
Assert.That(aimRenderer, Is.Not.Null);
|
||||
|
||||
var focusVersion = runtime.ActiveVersion;
|
||||
var inputDriver = root.GetComponent<EveUnityPlayableWorldInputDriver>() ??
|
||||
|
|
@ -448,6 +456,10 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
cameraRig.CameraTransform = camera.transform;
|
||||
cameraRig.RenderPolicySource = provider;
|
||||
Assert.That(cameraRig.ApplyRig(0f), Is.True);
|
||||
aimRenderer.RefreshNow();
|
||||
Assert.That(aimRenderer.ViewDotVisible, Is.True);
|
||||
aimDotDistance = Vector3.Distance(playerMarker.transform.position, aimRenderer.ViewDotPosition);
|
||||
Assert.That(aimDotDistance, Is.GreaterThanOrEqualTo(49.9f));
|
||||
Assert.That(camera.cullingMask & (1 << mapLayer), Is.Zero);
|
||||
Assert.That(camera.fieldOfView, Is.EqualTo(60f).Within(0.001f));
|
||||
var playerViewport = camera.WorldToViewportPoint(playerMarker.transform.position);
|
||||
|
|
@ -504,6 +516,7 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
(camera.cullingMask & (1 << mapLayer)) == 0,
|
||||
(mapCamera.cullingMask & (1 << mapLayer)) != 0,
|
||||
movementReceipt,
|
||||
lookReceipt,
|
||||
focusReceipt,
|
||||
actionReceipt,
|
||||
observedShot,
|
||||
|
|
@ -511,7 +524,8 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
observedCombat?.ShieldRatio ?? shieldRatioBefore,
|
||||
hullRatioBefore,
|
||||
observedCombat?.HullRatio ?? hullRatioBefore,
|
||||
(float)observedShot.LockQuality);
|
||||
(float)observedShot.LockQuality,
|
||||
aimDotDistance);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
@ -541,6 +555,7 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
bool pilotCameraExcludesMapChannel,
|
||||
bool mapCameraIncludesMapChannel,
|
||||
WitnessReceipt movement,
|
||||
WitnessReceipt look,
|
||||
WitnessReceipt targeting,
|
||||
WitnessReceipt action,
|
||||
EveUnityShotReceipt shot,
|
||||
|
|
@ -548,7 +563,8 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
float shieldRatioAfter,
|
||||
float hullRatioBefore,
|
||||
float hullRatioAfter,
|
||||
float lockProgress)
|
||||
float lockProgress,
|
||||
float aimDotDistance)
|
||||
{
|
||||
var path = Environment.GetEnvironmentVariable("EVEUNITY_WITNESS_FACTS_PATH");
|
||||
if (string.IsNullOrWhiteSpace(path)) return;
|
||||
|
|
@ -557,6 +573,7 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
providerAdvertisement = true,
|
||||
providerAssets = true,
|
||||
movement = movement != null,
|
||||
aimPresentation = look != null && aimDotDistance >= 49.9f,
|
||||
targeting = targeting != null,
|
||||
action = action != null,
|
||||
combatPresentation = shot != null,
|
||||
|
|
@ -573,13 +590,14 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
initialVersion = initialVersion,
|
||||
finalVersion = finalVersion,
|
||||
movementDistance = movementDistance,
|
||||
aimDotDistance = aimDotDistance,
|
||||
playerRendererCount = playerRendererCount,
|
||||
pilotChangedPixels = pilotChangedPixels,
|
||||
mapChannelRendererCount = mapChannelRendererCount,
|
||||
mapChangedPixels = mapChangedPixels,
|
||||
pilotCameraExcludesMapChannel = pilotCameraExcludesMapChannel,
|
||||
mapCameraIncludesMapChannel = mapCameraIncludesMapChannel,
|
||||
receipts = new[] { movement, targeting, action }
|
||||
receipts = new[] { movement, look, targeting, action }
|
||||
};
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(Path.GetFullPath(path)));
|
||||
File.WriteAllText(path, JsonUtility.ToJson(document, true));
|
||||
|
|
@ -591,6 +609,7 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
public bool providerAdvertisement;
|
||||
public bool providerAssets;
|
||||
public bool movement;
|
||||
public bool aimPresentation;
|
||||
public bool targeting;
|
||||
public bool action;
|
||||
public bool combatPresentation;
|
||||
|
|
@ -607,6 +626,7 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
public long initialVersion;
|
||||
public long finalVersion;
|
||||
public float movementDistance;
|
||||
public float aimDotDistance;
|
||||
public int playerRendererCount;
|
||||
public int pilotChangedPixels;
|
||||
public int mapChannelRendererCount;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
"org.gamecult.cultlib": "https://github.com/GameCult/CultLib.git?path=/unity/org.gamecult.cultlib#cultlib-unity-v1.0.13",
|
||||
"org.gamecult.eve.plugin-fields": "https://github.com/GameCult/EvePlugins.git?path=/plugins/eve-plugin-fields/unity/org.gamecult.eve.plugin-fields#eve-plugin-fields-unity-v0.1.1",
|
||||
"org.gamecult.eve.surface": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.surface#eveunity-surface-v0.2.1",
|
||||
"org.gamecult.eve.unity-scene": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.3.24",
|
||||
"org.gamecult.eve.unity-scene": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.3.25",
|
||||
"org.gamecult.eve.unity-uitoolkit": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-uitoolkit#eveunity-uitoolkit-v0.1.0"
|
||||
},
|
||||
"testables": [
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@
|
|||
"hash": "d0aa50d31f3b6da96bffc194fdc3aa358f37e332"
|
||||
},
|
||||
"org.gamecult.eve.unity-scene": {
|
||||
"version": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.3.24",
|
||||
"version": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.3.25",
|
||||
"depth": 0,
|
||||
"source": "git",
|
||||
"dependencies": {
|
||||
|
|
@ -151,7 +151,7 @@
|
|||
"org.gamecult.eve.surface": "0.2.1",
|
||||
"com.unity.mathematics": "1.3.2"
|
||||
},
|
||||
"hash": "e43f2d74557dcbf2cc408893c7b7d7ac708a44a8"
|
||||
"hash": "58d87c628a261751439584263c18e93a7d8d8708"
|
||||
},
|
||||
"org.gamecult.eve.unity-uitoolkit": {
|
||||
"version": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-uitoolkit#eveunity-uitoolkit-v0.1.0",
|
||||
|
|
|
|||
|
|
@ -188,6 +188,7 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
EveUnityPlayableWorldClientHost host = null;
|
||||
EveUnityPlayableWorldRuntime runtime = null;
|
||||
WitnessReceipt movementReceipt = null;
|
||||
WitnessReceipt lookReceipt = null;
|
||||
WitnessReceipt focusReceipt = null;
|
||||
WitnessReceipt actionReceipt = null;
|
||||
EveUnityShotReceipt observedShot = null;
|
||||
|
|
@ -196,6 +197,7 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
float hullRatioBefore = 0f;
|
||||
long initialVersion = 0;
|
||||
float movementDistance = 0f;
|
||||
float aimDotDistance = 0f;
|
||||
|
||||
try
|
||||
{
|
||||
|
|
@ -344,18 +346,24 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
aim.y = 0;
|
||||
Assert.That(aim.sqrMagnitude, Is.GreaterThan(0.0001f));
|
||||
aim.Normalize();
|
||||
var steerVersion = runtime.ActiveVersion;
|
||||
var steer = runtime.SubmitMoveVectorIntent(playerId, aim.x, aim.z, 0.25f);
|
||||
var steerDeadline = Time.realtimeSinceStartup + 12f;
|
||||
while (Time.realtimeSinceStartup < steerDeadline &&
|
||||
(runtime.LastReceipt == null || runtime.LastReceipt.CommandId != steer.CommandId ||
|
||||
!string.Equals(runtime.LastReceipt.State, "reconciled", StringComparison.OrdinalIgnoreCase)))
|
||||
var lookVersion = runtime.ActiveVersion;
|
||||
var look = runtime.SubmitLookDirectionIntent(playerId, aim.x, 0f, aim.z);
|
||||
var lookDeadline = Time.realtimeSinceStartup + 12f;
|
||||
while (Time.realtimeSinceStartup < lookDeadline &&
|
||||
(runtime.LastReceipt == null || runtime.LastReceipt.CommandId != look.CommandId ||
|
||||
!string.Equals(runtime.LastReceipt.State, "reconciled", StringComparison.OrdinalIgnoreCase) ||
|
||||
runtime.ActiveVersion < runtime.LastReceipt.SourceVersion ||
|
||||
Vector3.Dot(FindMarker(root, playerId).transform.forward, aim) < 0.99f))
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(0.1f);
|
||||
runtime.Refresh();
|
||||
}
|
||||
AssertReconciledProviderReceipt(runtime.LastReceipt, steer.CommandId,
|
||||
provider.Selection.ProviderId, provider.Selection.SurfaceId, steerVersion);
|
||||
AssertReconciledProviderReceipt(runtime.LastReceipt, look.CommandId,
|
||||
provider.Selection.ProviderId, provider.Selection.SurfaceId, lookVersion);
|
||||
Assert.That(Vector3.Dot(FindMarker(root, playerId).transform.forward, aim), Is.GreaterThan(0.99f));
|
||||
lookReceipt = WitnessReceipt.From("look", runtime.LastReceipt);
|
||||
var aimRenderer = root.GetComponent<EveUnityAimPresentationRenderer>();
|
||||
Assert.That(aimRenderer, Is.Not.Null);
|
||||
|
||||
var focusVersion = runtime.ActiveVersion;
|
||||
var inputDriver = root.GetComponent<EveUnityPlayableWorldInputDriver>() ??
|
||||
|
|
@ -448,6 +456,10 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
cameraRig.CameraTransform = camera.transform;
|
||||
cameraRig.RenderPolicySource = provider;
|
||||
Assert.That(cameraRig.ApplyRig(0f), Is.True);
|
||||
aimRenderer.RefreshNow();
|
||||
Assert.That(aimRenderer.ViewDotVisible, Is.True);
|
||||
aimDotDistance = Vector3.Distance(playerMarker.transform.position, aimRenderer.ViewDotPosition);
|
||||
Assert.That(aimDotDistance, Is.GreaterThanOrEqualTo(49.9f));
|
||||
Assert.That(camera.cullingMask & (1 << mapLayer), Is.Zero);
|
||||
Assert.That(camera.fieldOfView, Is.EqualTo(60f).Within(0.001f));
|
||||
var playerViewport = camera.WorldToViewportPoint(playerMarker.transform.position);
|
||||
|
|
@ -504,6 +516,7 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
(camera.cullingMask & (1 << mapLayer)) == 0,
|
||||
(mapCamera.cullingMask & (1 << mapLayer)) != 0,
|
||||
movementReceipt,
|
||||
lookReceipt,
|
||||
focusReceipt,
|
||||
actionReceipt,
|
||||
observedShot,
|
||||
|
|
@ -511,7 +524,8 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
observedCombat?.ShieldRatio ?? shieldRatioBefore,
|
||||
hullRatioBefore,
|
||||
observedCombat?.HullRatio ?? hullRatioBefore,
|
||||
(float)observedShot.LockQuality);
|
||||
(float)observedShot.LockQuality,
|
||||
aimDotDistance);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
@ -541,6 +555,7 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
bool pilotCameraExcludesMapChannel,
|
||||
bool mapCameraIncludesMapChannel,
|
||||
WitnessReceipt movement,
|
||||
WitnessReceipt look,
|
||||
WitnessReceipt targeting,
|
||||
WitnessReceipt action,
|
||||
EveUnityShotReceipt shot,
|
||||
|
|
@ -548,7 +563,8 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
float shieldRatioAfter,
|
||||
float hullRatioBefore,
|
||||
float hullRatioAfter,
|
||||
float lockProgress)
|
||||
float lockProgress,
|
||||
float aimDotDistance)
|
||||
{
|
||||
var path = Environment.GetEnvironmentVariable("EVEUNITY_WITNESS_FACTS_PATH");
|
||||
if (string.IsNullOrWhiteSpace(path)) return;
|
||||
|
|
@ -557,6 +573,7 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
providerAdvertisement = true,
|
||||
providerAssets = true,
|
||||
movement = movement != null,
|
||||
aimPresentation = look != null && aimDotDistance >= 49.9f,
|
||||
targeting = targeting != null,
|
||||
action = action != null,
|
||||
combatPresentation = shot != null,
|
||||
|
|
@ -573,13 +590,14 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
initialVersion = initialVersion,
|
||||
finalVersion = finalVersion,
|
||||
movementDistance = movementDistance,
|
||||
aimDotDistance = aimDotDistance,
|
||||
playerRendererCount = playerRendererCount,
|
||||
pilotChangedPixels = pilotChangedPixels,
|
||||
mapChannelRendererCount = mapChannelRendererCount,
|
||||
mapChangedPixels = mapChangedPixels,
|
||||
pilotCameraExcludesMapChannel = pilotCameraExcludesMapChannel,
|
||||
mapCameraIncludesMapChannel = mapCameraIncludesMapChannel,
|
||||
receipts = new[] { movement, targeting, action }
|
||||
receipts = new[] { movement, look, targeting, action }
|
||||
};
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(Path.GetFullPath(path)));
|
||||
File.WriteAllText(path, JsonUtility.ToJson(document, true));
|
||||
|
|
@ -591,6 +609,7 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
public bool providerAdvertisement;
|
||||
public bool providerAssets;
|
||||
public bool movement;
|
||||
public bool aimPresentation;
|
||||
public bool targeting;
|
||||
public bool action;
|
||||
public bool combatPresentation;
|
||||
|
|
@ -607,6 +626,7 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
public long initialVersion;
|
||||
public long finalVersion;
|
||||
public float movementDistance;
|
||||
public float aimDotDistance;
|
||||
public int playerRendererCount;
|
||||
public int pilotChangedPixels;
|
||||
public int mapChannelRendererCount;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ param(
|
|||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$expectedEveUnityCommit = "e43f2d74557dcbf2cc408893c7b7d7ac708a44a8"
|
||||
$expectedEveUnityCommit = "58d87c628a261751439584263c18e93a7d8d8708"
|
||||
$expectedCultLibCommit = "feb5c71513e71d681699f462fe3682b3168c6f73"
|
||||
$repoRoot = Split-Path -Parent $PSScriptRoot
|
||||
$projectRoot = $ClientProject
|
||||
|
|
|
|||
Reference in a new issue