Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing XML Documentation warnings. Pass 4 #11724

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ public static IEnumerator LoadNewScene(string sceneToBeLoaded, float delayInSeco
/// <summary>
/// Change the material color of the given <see cref="GameObject"/>.
/// </summary>
/// <param name="gameObject">The object whose material colors will be changed.</param>
/// <param name="target">The object whose material colors will be changed.</param>
/// <param name="newColor">The new color to apply to the object's materials.</param>
/// <param name="originalColor">Obtain the original color of the first material's <see cref="Material.color"/>. This must be <see langword="null"/> to obtain this original color.</param>
/// <param name="onlyApplyToRoot"><see langword="true"/> to only change materials on the root <see cref="GameObject"/>, and <see langword="false"/> to change children's materials too.</param>
public static void SetGameObjectColor(GameObject gameObject, Color newColor, ref Color? originalColor, bool onlyApplyToRoot)
public static void SetGameObjectColor(GameObject target, Color newColor, ref Color? originalColor, bool onlyApplyToRoot)
{
try
{
Renderer[] renderers = gameObject.GetComponents<Renderer>();
Renderer[] renderers = target.GetComponents<Renderer>();
for (int i = 0; i < renderers.Length; i++)
{
Material[] mats = renderers[i].materials;
Expand All @@ -76,7 +76,7 @@ public static void SetGameObjectColor(GameObject gameObject, Color newColor, ref

if (!onlyApplyToRoot)
{
renderers = gameObject.GetComponentsInChildren<Renderer>();
renderers = target.GetComponentsInChildren<Renderer>();
for (int i = 0; i < renderers.Length; i++)
{
Material[] mats = renderers[i].materials;
Expand All @@ -94,29 +94,30 @@ public static void SetGameObjectColor(GameObject gameObject, Color newColor, ref
}

/// <summary>
/// Change the transparency of game object "gameObject" with a transparency value between 0 and 1;
/// Change the transparency of a <see cref="GameObject"/> with a transparency value between 0 and 1.
/// </summary>
public static void GameObject_ChangeTransparency(GameObject gameObject, float newTransparency)
public static void SetGameObjectTransparency(GameObject target, float newTransparency)
{
float originalTransparency = 0; // just a dummy variable to reuse the following function
GameObject_ChangeTransparency(gameObject, newTransparency, ref originalTransparency);
SetGameObjectTransparency(target, newTransparency, ref originalTransparency);
}

/// <summary>
/// Change the transparency of game object "gameObject" with a transparency value between 0 and 255 with the option to
/// Change the transparency of a <see cref="GameObject"/> with a transparency value between 0 and 255 with the option to
/// receive the original transparency value back.
/// </summary>
/// <param name="target">The function will query for <see cref="Renderer"/> instances on this target object, and change the transparency on the found <see cref="Renderer"/> instances.</param>
/// <param name="transparency">Expected values range from 0 (fully transparent) to 1 (fully opaque).</param>
/// <param name="originalTransparency">Input "-1" if you don't know the original transparency yet.</param>
public static void GameObject_ChangeTransparency(GameObject gameObject, float transparency, ref float originalTransparency)
public static void SetGameObjectTransparency(GameObject target, float transparency, ref float originalTransparency)
{
try
{
// Go through renderers in main object
Renderers_ChangeTransparency(gameObject.GetComponents<Renderer>(), transparency, ref originalTransparency);
SetRenderersTransparency(target.GetComponents<Renderer>(), transparency, ref originalTransparency);

// Go through renderers in children objects
Renderers_ChangeTransparency(gameObject.GetComponentsInChildren<Renderer>(), transparency, ref originalTransparency);
SetRenderersTransparency(target.GetComponentsInChildren<Renderer>(), transparency, ref originalTransparency);
}
catch (System.Exception)
{
Expand All @@ -125,12 +126,12 @@ public static void GameObject_ChangeTransparency(GameObject gameObject, float tr
}

/// <summary>
/// Change the transparency of a given array of renderers to a given transparency value between 0 and 255;
/// Change the transparency of a given array of renderers to a given transparency value between 0 and 255.
/// </summary>
/// <param name="renderers">Array of renderers to apply a new transparency value to.</param>
/// <param name="transparency">Value between 0 and 255.</param>
/// <param name="originalTransparency">Option to return the original transparency value.</param>
private static void Renderers_ChangeTransparency(Renderer[] renderers, float transparency, ref float originalTransparency)
private static void SetRenderersTransparency(Renderer[] renderers, float transparency, ref float originalTransparency)
{
for (int i = 0; i < renderers.Length; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private bool

private bool manualTargetManipulation = false;

private Vector3 initalGazeDirection;
private Vector3 initialGazeDirection;
private static bool isManipulatingUsingHands = false;
private static bool isManipulatingUsingVoice = false;
private Vector3 handPositionAbsolute;
Expand All @@ -147,8 +147,8 @@ private bool

private Ray? headPreviousRay;
private float headDeltaDirectionThreshold = 0.05f;
private float headSmoothf = 0.1f;
private float headDeltaDirectionf = 0f;
private float headSmooth = 0.1f;
private float headDeltaDirection = 0f;

private int ConstraintX => freezeX ? 0 : 1;
private int ConstraintY => freezeY ? 0 : 1;
Expand All @@ -164,6 +164,7 @@ private bool
private readonly float minDiffAngleForVerticalPlacement = 50f;
#endregion

/// <inheritdoc />
public override float GetSelectionProgress()
{
return objectIsGrabbed ? 1f : base.GetSelectionProgress();
Expand Down Expand Up @@ -453,7 +454,7 @@ private void ActivatePreview()
{
previewGameObject = Instantiate(gameObject);
previewGameObject.GetComponent<Collider>().enabled = false;
EyeTrackingUtilities.GameObject_ChangeTransparency(previewGameObject, transparencyPreview);
EyeTrackingUtilities.SetGameObjectTransparency(previewGameObject, transparencyPreview);
placePreviewAtHitPoint = false;
}

Expand Down Expand Up @@ -481,17 +482,17 @@ private void DragAndDrop_Start()
if (!objectIsGrabbed && isHovered)
{
objectIsGrabbed = true;
EyeTrackingUtilities.GameObject_ChangeTransparency(gameObject, transparencyInTransition, ref originalTransparency);
EyeTrackingUtilities.SetGameObjectTransparency(gameObject, transparencyInTransition, ref originalTransparency);
initialHandPosition = handPositionAbsolute;
initalGazeDirection = new Vector3(Camera.main.transform.forward.x, Camera.main.transform.forward.y, Camera.main.transform.forward.z);
initialGazeDirection = new Vector3(Camera.main.transform.forward.x, Camera.main.transform.forward.y, Camera.main.transform.forward.z);

if (TryGetComponent<Rigidbody>(out var rbody))
if (TryGetComponent<Rigidbody>(out var rigidbody))
{
originalUseGravity = rbody.useGravity;
originalDrag = rbody.drag;
originalUseGravity = rigidbody.useGravity;
originalDrag = rigidbody.drag;

rbody.useGravity = false;
rbody.drag = float.PositiveInfinity;
rigidbody.useGravity = false;
rigidbody.drag = float.PositiveInfinity;
}
}
}
Expand All @@ -516,11 +517,11 @@ private void DragAndDrop_Finish()
objectIsGrabbed = false;
DeactivatePreview();

EyeTrackingUtilities.GameObject_ChangeTransparency(gameObject, originalTransparency);
if (TryGetComponent<Rigidbody>(out var rbody))
EyeTrackingUtilities.SetGameObjectTransparency(gameObject, originalTransparency);
if (TryGetComponent<Rigidbody>(out var rigidbody))
{
rbody.useGravity = originalUseGravity;
rbody.drag = originalDrag;
rigidbody.useGravity = originalUseGravity;
rigidbody.drag = originalDrag;
}

onDrop.Invoke();
Expand All @@ -541,20 +542,20 @@ private void RelativeMoveUpdate(Vector3 relativeMovement)
/// </summary>
private float Angle_InitialGazeToCurrGazeDir()
{
return Vector3.Angle(initalGazeDirection, Camera.main.transform.forward);
return Vector3.Angle(initialGazeDirection, Camera.main.transform.forward);
}

/// <summary>
/// Compute angle between target center ( OR original targeting location??? ) and current targeting direction
/// Compute angle between target center and current targeting direction
/// </summary>
private float Angle_ToCurrHitTarget(GameObject gobj)
private float Angle_ToCurrHitTarget(GameObject target)
{
if (gazeInteractor.PreciseHitResult.targetInteractable != null)
{
// Target is currently hit
if (gazeInteractor.PreciseHitResult.targetInteractable.transform.gameObject == gobj)
if (gazeInteractor.PreciseHitResult.targetInteractable.transform.gameObject == target)
{
initalGazeDirection = new Vector3(Camera.main.transform.forward.x, Camera.main.transform.forward.y, Camera.main.transform.forward.z);
initialGazeDirection = new Vector3(Camera.main.transform.forward.x, Camera.main.transform.forward.y, Camera.main.transform.forward.z);
return 0.0f;
}

Expand All @@ -579,9 +580,9 @@ private bool HeadIsInMotion()
float deltaDir = Vector3.Distance(headPreviousRay.Value.direction, forward);
if (deltaPos != 0f && deltaDir != 0f)
{
headDeltaDirectionf = deltaDir * headSmoothf + headDeltaDirectionf * (1f - headSmoothf);
headDeltaDirection = deltaDir * headSmooth + headDeltaDirection * (1f - headSmooth);

headIsInMotion = headDeltaDirectionf > headDeltaDirectionThreshold;
headIsInMotion = headDeltaDirection > headDeltaDirectionThreshold;
}
}

Expand Down Expand Up @@ -617,13 +618,13 @@ private void MoveTargetBy(Vector3 delta)
hitPosition.y += gameObject.transform.localScale.y * 0.5f;
}

Vector3 objp = gameObject.transform.position;
Vector3 objectPosition = gameObject.transform.position;

// Constrain in y-direction
gameObject.transform.position = new Vector3(
(((ConstraintX + 1) % 2) * objp.x) + (ConstraintX * hitPosition.x),
(((ConstraintY + 1) % 2) * objp.y) + (ConstraintY * hitPosition.y),
(((ConstraintZ + 1) % 2) * objp.z) + (ConstraintZ * hitPosition.z));
(((ConstraintX + 1) % 2) * objectPosition.x) + (ConstraintX * hitPosition.x),
(((ConstraintY + 1) % 2) * objectPosition.y) + (ConstraintY * hitPosition.y),
(((ConstraintZ + 1) % 2) * objectPosition.z) + (ConstraintZ * hitPosition.z));

ConstrainMovement();

Expand Down Expand Up @@ -675,13 +676,13 @@ private void MoveTargetTo(Vector3 destination)
destination.y += gameObject.transform.localScale.y * 0.5f;
}

Vector3 objp = gameObject.transform.position;
Vector3 objectPosition = gameObject.transform.position;

// Constrain movement
gameObject.transform.position = new Vector3(
((ConstraintX + 1) % 2 * objp.x) + (ConstraintX * destination.x),
((ConstraintY + 1) % 2 * objp.y) + (ConstraintY * destination.y),
((ConstraintZ + 1) % 2 * objp.z) + (ConstraintZ * destination.z));
((ConstraintX + 1) % 2 * objectPosition.x) + (ConstraintX * destination.x),
((ConstraintY + 1) % 2 * objectPosition.y) + (ConstraintY * destination.y),
((ConstraintZ + 1) % 2 * objectPosition.z) + (ConstraintZ * destination.z));

initialHandPosition = handPositionAbsolute;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public override void ProcessInteractable(XRInteractionUpdateOrder.UpdatePhase up
}

/// <summary>
/// Updates the heat map with a hit at <param name="hitPosition"></param>.
/// Updates the heat map with a hit at <paramref name="hitPosition"/>.
/// </summary>
/// <param name="hitPosition">The hit position in world co-ordinates.</param>
public void DrawAtThisHitPos(Vector3 hitPosition)
Expand Down
Loading