Skip to content

Commit

Permalink
fix(Simulator): missing headset fade implementations
Browse files Browse the repository at this point in the history
#1068 added headset fading to the Simulator SDK but actually missed two
other methods that need to be implemented for it to work correctly. This
fix implements those methods.
  • Loading branch information
Christopher - Marcel Böddecker committed Apr 3, 2017
1 parent fc51ae5 commit bbf0a03
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Assets/VRTK/SDK/Simulator/SDK_SimHeadset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public override Vector3 GetHeadsetAngularVelocity()
/// <param name="fadeOverlay">Determines whether to use an overlay on the fade.</param>
public override void HeadsetFade(Color color, float duration, bool fadeOverlay = false)
{

VRTK_ScreenFade.Start(color, duration);
}

/// <summary>
Expand All @@ -119,7 +119,7 @@ public override void HeadsetFade(Color color, float duration, bool fadeOverlay =
/// <returns>Returns true if the headset has fade functionality on it.</returns>
public override bool HasHeadsetFade(Transform obj)
{
return false;
return obj.GetComponentInChildren<VRTK_ScreenFade>() != null;
}

/// <summary>
Expand All @@ -128,7 +128,7 @@ public override bool HasHeadsetFade(Transform obj)
/// <param name="camera">The Transform to with the camera on to add the fade functionality to.</param>
public override void AddHeadsetFade(Transform camera)
{
if (camera && !camera.GetComponent<VRTK_ScreenFade>())
if (camera != null && camera.GetComponent<VRTK_ScreenFade>() == null)
{
camera.gameObject.AddComponent<VRTK_ScreenFade>();
}
Expand Down

0 comments on commit bbf0a03

Please sign in to comment.