Skip to content

Commit c48a9cd

Browse files
committed
chore(Structure): remove var usage
A number of files contained `var` declarations for variables and this is something that is being phased out of the code guidelines for the project. This commit removes existing `var` declarations.
1 parent 0abf9b7 commit c48a9cd

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

Assets/VRTK/Source/SDK/Base/SDK_BaseBoundaries.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public abstract class SDK_BaseBoundaries : SDK_Base
5656

5757
protected Transform GetSDKManagerPlayArea()
5858
{
59-
var sdkManager = VRTK_SDKManager.instance;
59+
VRTK_SDKManager sdkManager = VRTK_SDKManager.instance;
6060
if (sdkManager != null && sdkManager.loadedSetup.actualBoundaries != null)
6161
{
6262
cachedPlayArea = (sdkManager.loadedSetup.actualBoundaries ? sdkManager.loadedSetup.actualBoundaries.transform : null);

Assets/VRTK/Source/SDK/SteamVR/SDK_SteamVRBoundaries.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public override Transform GetPlayArea()
4747
cachedPlayArea = GetSDKManagerPlayArea();
4848
if (cachedPlayArea == null)
4949
{
50-
var steamVRPlayArea = VRTK_SharedMethods.FindEvenInactiveComponent<SteamVR_PlayArea>();
50+
SteamVR_PlayArea steamVRPlayArea = VRTK_SharedMethods.FindEvenInactiveComponent<SteamVR_PlayArea>();
5151
if (steamVRPlayArea != null)
5252
{
5353
cachedSteamVRPlayArea = steamVRPlayArea;

Assets/VRTK/Source/Scripts/Interactions/Interactables/VRTK_InteractControllerAppearance.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public virtual void ToggleControllerOnGrab(bool showController, GameObject grabb
191191
{
192192
if (hideControllerOnGrab)
193193
{
194-
var objScript = (ignoredObject != null ? ignoredObject.GetComponentInParent<VRTK_InteractableObject>() : null);
194+
VRTK_InteractableObject objScript = (ignoredObject != null ? ignoredObject.GetComponentInParent<VRTK_InteractableObject>() : null);
195195

196196
//if attempting to show the controller but it's touched and the touch should hide the controller
197197
if (showController && !touchControllerShow && objScript && objScript.IsTouched())
@@ -222,7 +222,7 @@ public virtual void ToggleControllerOnUse(bool showController, GameObject usingO
222222
{
223223
if (hideControllerOnUse)
224224
{
225-
var objScript = (ignoredObject != null ? ignoredObject.GetComponentInParent<VRTK_InteractableObject>() : null);
225+
VRTK_InteractableObject objScript = (ignoredObject != null ? ignoredObject.GetComponentInParent<VRTK_InteractableObject>() : null);
226226

227227
//if attempting to show the controller but it's grabbed and the grab should hide the controller
228228
if (showController && ((!grabControllerShow && objScript && objScript.IsGrabbed()) || (!touchControllerShow && objScript && objScript.IsTouched())))

Assets/VRTK/Source/Scripts/Internal/VRTK_CurveGenerator.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ protected virtual void SetObjects(Material material, Color color)
334334
float stepSize = frequency * 1;
335335
if (Loop || stepSize == 1)
336336
{
337-
stepSize = VRTK_SharedMethods.DividerToMultiplier(stepSize );
337+
stepSize = VRTK_SharedMethods.DividerToMultiplier(stepSize);
338338
}
339339
else
340340
{
@@ -392,14 +392,14 @@ protected virtual void SetItemPosition(int currentIndex, Vector3 setPosition, Ma
392392

393393
protected virtual void SetItemMaterial(GameObject item, Material material, Color color)
394394
{
395-
foreach (Renderer mr in item.GetComponentsInChildren<Renderer>())
395+
Renderer[] itemRenderers = item.GetComponentsInChildren<Renderer>();
396+
for (int i = 0; i < itemRenderers.Length; i++)
396397
{
397398
if (material != null)
398399
{
399-
mr.material = material;
400+
itemRenderers[i].material = material;
400401
}
401-
402-
SetMaterial(mr.material, color);
402+
SetMaterial(itemRenderers[i].material, color);
403403
}
404404
}
405405

0 commit comments

Comments
 (0)