From 20cd537eb6659f74c79383d9961efaf0f1e8819e Mon Sep 17 00:00:00 2001 From: Pavel Kvas Date: Sat, 14 May 2016 14:08:37 +0300 Subject: [PATCH] remove redundant if checks for stage field --- .../Scripts/Commands/ControlStage.cs | 25 ++++++++--------- .../Narrative/Scripts/Commands/Portrait.cs | 27 +++++++++---------- Assets/FungusExamples/FungusLua/Scripts.meta | 9 ------- 3 files changed, 25 insertions(+), 36 deletions(-) delete mode 100644 Assets/FungusExamples/FungusLua/Scripts.meta diff --git a/Assets/Fungus/Narrative/Scripts/Commands/ControlStage.cs b/Assets/Fungus/Narrative/Scripts/Commands/ControlStage.cs index 0147b62e..c1517fdb 100644 --- a/Assets/Fungus/Narrative/Scripts/Commands/ControlStage.cs +++ b/Assets/Fungus/Narrative/Scripts/Commands/ControlStage.cs @@ -49,20 +49,21 @@ namespace Fungus Continue(); return; } + // Selected "use default Portrait Stage" - if (stage == null) // Default portrait stage selected - { - if (stage == null) // If no default specified, try to get any portrait stage in the scene - { - stage = GameObject.FindObjectOfType(); - } - } - // If portrait stage does not exist, do nothing - if (stage == null) + if (stage == null) { - Continue(); - return; - } + // If no default specified, try to get any portrait stage in the scene + stage = FindObjectOfType(); + + // If portrait stage does not exist, do nothing + if (stage == null) + { + Continue(); + return; + } + } + // Selected "use default Portrait Stage" if (display == StageDisplayType.Swap) // Default portrait stage selected { diff --git a/Assets/Fungus/Narrative/Scripts/Commands/Portrait.cs b/Assets/Fungus/Narrative/Scripts/Commands/Portrait.cs index 7a81381c..07c42ff6 100755 --- a/Assets/Fungus/Narrative/Scripts/Commands/Portrait.cs +++ b/Assets/Fungus/Narrative/Scripts/Commands/Portrait.cs @@ -120,21 +120,18 @@ namespace Fungus return; } - // Selected "use default Portrait Stage" - if (stage == null) // Default portrait stage selected - { - if (stage == null) // If no default specified, try to get any portrait stage in the scene - { - stage = GameObject.FindObjectOfType(); - } - } - - // If portrait stage does not exist, do nothing - if (stage == null) - { - Continue(); - return; - } + // Selected "use default Portrait Stage" + if (stage == null) + { + // If no default specified, try to get any portrait stage in the scene + stage = FindObjectOfType(); + // If portrait stage does not exist, do nothing + if (stage == null) + { + Continue(); + return; + } + } // Early out if hiding a character that's already hidden if (display == DisplayType.Hide && diff --git a/Assets/FungusExamples/FungusLua/Scripts.meta b/Assets/FungusExamples/FungusLua/Scripts.meta deleted file mode 100644 index d220dac7..00000000 --- a/Assets/FungusExamples/FungusLua/Scripts.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: e2e93e4a664384c7592b4692703284e3 -folderAsset: yes -timeCreated: 1462350061 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: