diff --git a/Assets/Fungus/Thirdparty/iTween/iTween.cs b/Assets/Fungus/Thirdparty/iTween/iTween.cs index 5b5b92a7..64a10ccf 100644 --- a/Assets/Fungus/Thirdparty/iTween/iTween.cs +++ b/Assets/Fungus/Thirdparty/iTween/iTween.cs @@ -225,6 +225,7 @@ public class iTween : MonoBehaviour{ /// public static void Init(GameObject target){ MoveBy(target,Vector3.zero,0); + cameraFade = null; } /// @@ -705,11 +706,7 @@ public class iTween : MonoBehaviour{ } //set tempColor and base fromColor: - if(target.GetComponent()){ - tempColor=fromColor=target.GetComponent().color; - }else if(target.GetComponent()){ - tempColor=fromColor=target.GetComponent().material.color; - }else if(target.GetComponent()){ + if(target.GetComponent()){ tempColor=fromColor=target.GetComponent().material.color; }else if(target.GetComponent()){ tempColor=fromColor=target.GetComponent().color; @@ -743,11 +740,7 @@ public class iTween : MonoBehaviour{ } //apply fromColor: - if(target.GetComponent()){ - target.GetComponent().color=fromColor; - }else if(target.GetComponent()){ - target.GetComponent().material.color=fromColor; - }else if(target.GetComponent()){ + if(target.GetComponent()){ target.GetComponent().material.color=fromColor; }else if(target.GetComponent()){ target.GetComponent().color=fromColor; @@ -3332,13 +3325,7 @@ public class iTween : MonoBehaviour{ //colors = new Color[3]; //from and init to values: - if(GetComponent()){ - colors = new Color[1,3]; - colors[0,0] = colors[0,1] = GetComponent().color; - }else if(GetComponent()){ - colors = new Color[1,3]; - colors[0,0] = colors[0,1] = GetComponent().material.color; - }else if(GetComponent()){ + if(GetComponent()){ colors = new Color[GetComponent().materials.Length,3]; for (int i = 0; i < GetComponent().materials.Length; i++) { colors[i,0]=GetComponent().materials[i].GetColor(namedcolorvalue.ToString()); @@ -4108,13 +4095,7 @@ public class iTween : MonoBehaviour{ */ //apply: - if(GetComponent()){ - //guiTexture.color=colors[2]; - GetComponent().color=colors[0,2]; - }else if(GetComponent()){ - //guiText.material.color=colors[2]; - GetComponent().material.color=colors[0,2]; - }else if(GetComponent()){ + if(GetComponent()){ //renderer.material.color=colors[2]; for (int i = 0; i < colors.GetLength(0); i++) { GetComponent().materials[i].SetColor(namedcolorvalue.ToString(),colors[i,2]); @@ -4126,13 +4107,7 @@ public class iTween : MonoBehaviour{ //dial in: if(percentage==1){ - if(GetComponent()){ - //guiTexture.color=colors[1]; - GetComponent().color=colors[0,1]; - }else if(GetComponent()){ - //guiText.material.color=colors[1]; - GetComponent().material.color=colors[0,1]; - }else if(GetComponent()){ + if(GetComponent()){ //renderer.material.color=colors[1]; for (int i = 0; i < colors.GetLength(0); i++) { GetComponent().materials[i].SetColor(namedcolorvalue.ToString(),colors[i,1]); @@ -4854,11 +4829,7 @@ public class iTween : MonoBehaviour{ } //init values: - if(target.GetComponent()){ - colors[0] = colors[1] = target.GetComponent().color; - }else if(target.GetComponent()){ - colors[0] = colors[1] = target.GetComponent().material.color; - }else if(target.GetComponent()){ + if(target.GetComponent()){ colors[0] = colors[1] = target.GetComponent().material.color; }else if(target.GetComponent()){ colors[0] = colors[1] = target.GetComponent().color; @@ -4889,11 +4860,7 @@ public class iTween : MonoBehaviour{ colors[3].a=Mathf.SmoothDamp(colors[0].a,colors[1].a,ref colors[2].a,time); //apply: - if(target.GetComponent()){ - target.GetComponent().color=colors[3]; - }else if(target.GetComponent()){ - target.GetComponent().material.color=colors[3]; - }else if(target.GetComponent()){ + if(target.GetComponent()){ target.GetComponent().material.color=colors[3]; }else if(target.GetComponent()){ target.GetComponent().color=colors[3]; @@ -6008,90 +5975,8 @@ public class iTween : MonoBehaviour{ if(cameraFade){ Destroy(cameraFade); } - } - - /// - /// Changes a camera fade's texture. - /// - /// - /// A - /// - public static void CameraFadeSwap(Texture2D texture){ - if(cameraFade){ - cameraFade.GetComponent().texture=texture; - } - } - - /// - /// Creates a GameObject (if it doesn't exist) at the supplied depth that can be used to simulate a camera fade. - /// - /// - /// A - /// - /// - /// A - /// - /// - /// A for a reference to the CameraFade. - /// - public static GameObject CameraFadeAdd(Texture2D texture, int depth){ - if(cameraFade){ - return null; - }else{ - //establish colorFade object: - cameraFade = new GameObject("iTween Camera Fade"); - cameraFade.transform.position= new Vector3(.5f,.5f,depth); - cameraFade.AddComponent(); - cameraFade.GetComponent().texture=texture; - cameraFade.GetComponent().color = new Color(.5f,.5f,.5f,0); - return cameraFade; - } - } - - /// - /// Creates a GameObject (if it doesn't exist) at the default depth that can be used to simulate a camera fade. - /// - /// - /// A - /// - /// - /// A for a reference to the CameraFade. - /// - public static GameObject CameraFadeAdd(Texture2D texture){ - if(cameraFade){ - return null; - }else{ - //establish colorFade object: - cameraFade = new GameObject("iTween Camera Fade"); - cameraFade.transform.position= new Vector3(.5f,.5f,Defaults.cameraFadeDepth); - cameraFade.AddComponent(); - cameraFade.GetComponent().texture=texture; - cameraFade.GetComponent().color = new Color(.5f,.5f,.5f,0); - return cameraFade; - } - } - - /// - /// Creates a GameObject (if it doesn't exist) at the default depth filled with black that can be used to simulate a camera fade. - /// - /// - /// A for a reference to the CameraFade. - /// - public static GameObject CameraFadeAdd(){ - if(cameraFade){ - return null; - }else{ - //establish colorFade object: - cameraFade = new GameObject("iTween Camera Fade"); - cameraFade.transform.position= new Vector3(.5f,.5f,Defaults.cameraFadeDepth); - cameraFade.AddComponent(); - cameraFade.GetComponent().texture=CameraTexture(Color.black); - cameraFade.GetComponent().color = new Color(.5f,.5f,.5f,0); - return cameraFade; - } } - //################################# //# RESUME UTILITIES AND OVERLOADS # //#################################