Browse Source

Changed float comparisons to use Mathf.Approximately

master
Christopher 8 years ago
parent
commit
44aade812b
  1. 2
      Assets/Fungus/Scripts/Commands/CallMethod.cs
  2. 6
      Assets/Fungus/Scripts/Commands/FadeUI.cs
  3. 2
      Assets/Fungus/Scripts/Commands/PlayUsfxrSound.cs
  4. 2
      Assets/Fungus/Scripts/Components/CameraManager.cs
  5. 2
      Assets/Fungus/Scripts/Components/MusicManager.cs
  6. 2
      Assets/Fungus/Scripts/Components/SayDialog.cs
  7. 2
      Assets/Fungus/Scripts/Components/SpriteFader.cs

2
Assets/Fungus/Scripts/Commands/CallMethod.cs

@ -41,7 +41,7 @@ namespace Fungus.Commands
return;
}
if (delay == 0f)
if (Mathf.Approximately(delay, 0f))
{
CallTheMethod();
}

6
Assets/Fungus/Scripts/Commands/FadeUI.cs

@ -37,7 +37,7 @@ namespace Fungus.Commands
{
foreach (Image image in go.GetComponentsInChildren<Image>())
{
if (duration == 0f)
if (Mathf.Approximately(duration, 0f))
{
switch (fadeMode)
{
@ -67,7 +67,7 @@ namespace Fungus.Commands
foreach (Text text in go.GetComponentsInChildren<Text>())
{
if (duration == 0f)
if (Mathf.Approximately(duration, 0f))
{
switch (fadeMode)
{
@ -97,7 +97,7 @@ namespace Fungus.Commands
foreach (TextMesh textMesh in go.GetComponentsInChildren<TextMesh>())
{
if (duration == 0f)
if (Mathf.Approximately(duration, 0f))
{
switch (fadeMode)
{

2
Assets/Fungus/Scripts/Commands/PlayUsfxrSound.cs

@ -56,7 +56,7 @@ using Fungus.Variables;
{
_synth.SetParentTransform(ParentTransform);
_synth.Play();
if (waitDuration == 0f)
if (Mathf.Approximately(waitDuration, 0f))
{
Continue();
}

2
Assets/Fungus/Scripts/Components/CameraManager.cs

@ -428,7 +428,7 @@ namespace Fungus
swipePanActive = false;
if (duration == 0f)
if (Mathf.Approximately(duration, 0f))
{
// Move immediately
camera.orthographicSize = targetSize;

2
Assets/Fungus/Scripts/Components/MusicManager.cs

@ -78,7 +78,7 @@ namespace Fungus
{
AudioSource audio = GetComponent<AudioSource>();
if (duration == 0f)
if (Mathf.Approximately(duration, 0f))
{
audio.pitch = pitch;
if (onComplete != null)

2
Assets/Fungus/Scripts/Components/SayDialog.cs

@ -144,7 +144,7 @@ namespace Fungus
targetAlpha = 1f;
fadeCoolDownTimer = 0.1f;
}
else if (fadeWhenDone && fadeCoolDownTimer == 0f)
else if (fadeWhenDone && Mathf.Approximately(fadeCoolDownTimer, 0f))
{
targetAlpha = 0f;
}

2
Assets/Fungus/Scripts/Components/SpriteFader.cs

@ -96,7 +96,7 @@ namespace Fungus
}
// Early out if duration is zero
if (duration == 0f)
if (Mathf.Approximately(duration, 0f))
{
spriteRenderer.color = targetColor;
if (onComplete != null)

Loading…
Cancel
Save