@ -706,13 +706,13 @@ public class iTween : MonoBehaviour{
//set tempColor and base fromColor:
if ( target . GetComponent < GUITexture > ( ) ) {
tempColor = fromColor = target . guiTexture . color ;
tempColor = fromColor = target . GetComponent < GUITexture > ( ) . color ;
} else if ( target . GetComponent < GUIText > ( ) ) {
tempColor = fromColor = target . guiText . material . color ;
} else if ( target . renderer ) {
tempColor = fromColor = target . renderer . material . color ;
} else if ( target . l ight) {
tempColor = fromColor = target . l ight. color ;
tempColor = fromColor = target . GetComponent < GUIText > ( ) . material . color ;
} else if ( target . GetComponent < Renderer > ( ) ) {
tempColor = fromColor = target . GetComponent < Renderer > ( ) . material . color ;
} else if ( target . GetComponent < L ight> ( ) ) {
tempColor = fromColor = target . GetComponent < L ight> ( ) . color ;
}
//set augmented fromColor:
@ -744,13 +744,13 @@ public class iTween : MonoBehaviour{
//apply fromColor:
if ( target . GetComponent < GUITexture > ( ) ) {
target . guiTexture . color = fromColor ;
target . GetComponent < GUITexture > ( ) . color = fromColor ;
} else if ( target . GetComponent < GUIText > ( ) ) {
target . guiText . material . color = fromColor ;
} else if ( target . renderer ) {
target . renderer . material . color = fromColor ;
} else if ( target . l ight) {
target . l ight. color = fromColor ;
target . GetComponent < GUIText > ( ) . material . color = fromColor ;
} else if ( target . GetComponent < Renderer > ( ) ) {
target . GetComponent < Renderer > ( ) . material . color = fromColor ;
} else if ( target . GetComponent < L ight> ( ) ) {
target . GetComponent < L ight> ( ) . color = fromColor ;
}
//set new color arg:
@ -948,7 +948,7 @@ public class iTween : MonoBehaviour{
tempAudioSource = ( AudioSource ) args [ "audiosource" ] ;
} else {
if ( target . GetComponent < AudioSource > ( ) ) {
tempAudioSource = target . a udio;
tempAudioSource = target . GetComponent < A udioSource > ( ) ;
} else {
//throw error if no AudioSource is available:
Debug . LogError ( "iTween Error: AudioFrom requires an AudioSource." ) ;
@ -3334,20 +3334,20 @@ public class iTween : MonoBehaviour{
//from and init to values:
if ( GetComponent < GUITexture > ( ) ) {
colors = new Color [ 1 , 3 ] ;
colors [ 0 , 0 ] = colors [ 0 , 1 ] = guiTexture . color ;
colors [ 0 , 0 ] = colors [ 0 , 1 ] = GetComponent < GUITexture > ( ) . color ;
} else if ( GetComponent < GUIText > ( ) ) {
colors = new Color [ 1 , 3 ] ;
colors [ 0 , 0 ] = colors [ 0 , 1 ] = guiText . material . color ;
} else if ( renderer ) {
colors = new Color [ renderer . materials . Length , 3 ] ;
for ( int i = 0 ; i < renderer . materials . Length ; i + + ) {
colors [ i , 0 ] = renderer . materials [ i ] . GetColor ( namedcolorvalue . ToString ( ) ) ;
colors [ i , 1 ] = renderer . materials [ i ] . GetColor ( namedcolorvalue . ToString ( ) ) ;
colors [ 0 , 0 ] = colors [ 0 , 1 ] = GetComponent < GUIText > ( ) . material . color ;
} else if ( GetComponent < Renderer > ( ) ) {
colors = new Color [ GetComponent < Renderer > ( ) . materials . Length , 3 ] ;
for ( int i = 0 ; i < GetComponent < Renderer > ( ) . materials . Length ; i + + ) {
colors [ i , 0 ] = GetComponent < Renderer > ( ) . materials [ i ] . GetColor ( namedcolorvalue . ToString ( ) ) ;
colors [ i , 1 ] = GetComponent < Renderer > ( ) . materials [ i ] . GetColor ( namedcolorvalue . ToString ( ) ) ;
}
//colors[0] = colors[1] = renderer.material.color;
} else if ( l ight) {
} else if ( GetComponent < L ight> ( ) ) {
colors = new Color [ 1 , 3 ] ;
colors [ 0 , 0 ] = colors [ 0 , 1 ] = l ight. color ;
colors [ 0 , 0 ] = colors [ 0 , 1 ] = GetComponent < L ight> ( ) . color ;
} else {
colors = new Color [ 1 , 3 ] ; //empty placeholder incase the GO is perhaps an empty holder or something similar
}
@ -3408,7 +3408,7 @@ public class iTween : MonoBehaviour{
audioSource = ( AudioSource ) tweenArguments [ "audiosource" ] ;
} else {
if ( GetComponent < AudioSource > ( ) ) {
audioSource = a udio;
audioSource = GetComponent < A udioSource > ( ) ;
} else {
//throw error if no AudioSource is available:
Debug . LogError ( "iTween Error: AudioTo requires an AudioSource." ) ;
@ -3434,11 +3434,11 @@ public class iTween : MonoBehaviour{
audioSource = ( AudioSource ) tweenArguments [ "audiosource" ] ;
} else {
if ( GetComponent < AudioSource > ( ) ) {
audioSource = a udio;
audioSource = GetComponent < A udioSource > ( ) ;
} else {
//add and populate AudioSource if one doesn't exist:
gameObject . AddComponent < AudioSource > ( ) ;
audioSource = a udio;
audioSource = GetComponent < A udioSource > ( ) ;
audioSource . playOnAwake = false ;
}
@ -4110,36 +4110,36 @@ public class iTween : MonoBehaviour{
//apply:
if ( GetComponent < GUITexture > ( ) ) {
//guiTexture.color=colors[2];
guiTexture . color = colors [ 0 , 2 ] ;
GetComponent < GUITexture > ( ) . color = colors [ 0 , 2 ] ;
} else if ( GetComponent < GUIText > ( ) ) {
//guiText.material.color=colors[2];
guiText . material . color = colors [ 0 , 2 ] ;
} else if ( renderer ) {
GetComponent < GUIText > ( ) . material . color = colors [ 0 , 2 ] ;
} else if ( GetComponent < Renderer > ( ) ) {
//renderer.material.color=colors[2];
for ( int i = 0 ; i < colors . GetLength ( 0 ) ; i + + ) {
renderer . materials [ i ] . SetColor ( namedcolorvalue . ToString ( ) , colors [ i , 2 ] ) ;
GetComponent < Renderer > ( ) . materials [ i ] . SetColor ( namedcolorvalue . ToString ( ) , colors [ i , 2 ] ) ;
}
} else if ( l ight) {
} else if ( GetComponent < L ight> ( ) ) {
//light.color=colors[2];
l ight. color = colors [ 0 , 2 ] ;
GetComponent < L ight> ( ) . color = colors [ 0 , 2 ] ;
}
//dial in:
if ( percentage = = 1 ) {
if ( GetComponent < GUITexture > ( ) ) {
//guiTexture.color=colors[1];
guiTexture . color = colors [ 0 , 1 ] ;
GetComponent < GUITexture > ( ) . color = colors [ 0 , 1 ] ;
} else if ( GetComponent < GUIText > ( ) ) {
//guiText.material.color=colors[1];
guiText . material . color = colors [ 0 , 1 ] ;
} else if ( renderer ) {
GetComponent < GUIText > ( ) . material . color = colors [ 0 , 1 ] ;
} else if ( GetComponent < Renderer > ( ) ) {
//renderer.material.color=colors[1];
for ( int i = 0 ; i < colors . GetLength ( 0 ) ; i + + ) {
renderer . materials [ i ] . SetColor ( namedcolorvalue . ToString ( ) , colors [ i , 1 ] ) ;
GetComponent < Renderer > ( ) . materials [ i ] . SetColor ( namedcolorvalue . ToString ( ) , colors [ i , 1 ] ) ;
}
} else if ( l ight) {
} else if ( GetComponent < L ight> ( ) ) {
//light.color=colors[1];
l ight. color = colors [ 0 , 1 ] ;
GetComponent < L ight> ( ) . color = colors [ 0 , 1 ] ;
}
}
}
@ -4198,7 +4198,7 @@ public class iTween : MonoBehaviour{
postUpdate = thisTransform . position ;
if ( physics ) {
thisTransform . position = preUpdate ;
rigidbody . MovePosition ( postUpdate ) ;
GetComponent < Rigidbody > ( ) . MovePosition ( postUpdate ) ;
}
}
@ -4232,7 +4232,7 @@ public class iTween : MonoBehaviour{
postUpdate = thisTransform . position ;
if ( physics ) {
thisTransform . position = preUpdate ;
rigidbody . MovePosition ( postUpdate ) ;
GetComponent < Rigidbody > ( ) . MovePosition ( postUpdate ) ;
}
}
@ -4274,7 +4274,7 @@ public class iTween : MonoBehaviour{
postUpdate = thisTransform . position ;
if ( physics ) {
thisTransform . position = preUpdate ;
rigidbody . MovePosition ( postUpdate ) ;
GetComponent < Rigidbody > ( ) . MovePosition ( postUpdate ) ;
}
}
@ -4335,7 +4335,7 @@ public class iTween : MonoBehaviour{
postUpdate = thisTransform . eulerAngles ;
if ( physics ) {
thisTransform . eulerAngles = preUpdate ;
rigidbody . MoveRotation ( Quaternion . Euler ( postUpdate ) ) ;
GetComponent < Rigidbody > ( ) . MoveRotation ( Quaternion . Euler ( postUpdate ) ) ;
}
}
@ -4357,7 +4357,7 @@ public class iTween : MonoBehaviour{
postUpdate = thisTransform . eulerAngles ;
if ( physics ) {
thisTransform . eulerAngles = preUpdate ;
rigidbody . MoveRotation ( Quaternion . Euler ( postUpdate ) ) ;
GetComponent < Rigidbody > ( ) . MoveRotation ( Quaternion . Euler ( postUpdate ) ) ;
}
}
@ -4413,7 +4413,7 @@ public class iTween : MonoBehaviour{
postUpdate = thisTransform . position ;
if ( physics ) {
thisTransform . position = preUpdate ;
rigidbody . MovePosition ( postUpdate ) ;
GetComponent < Rigidbody > ( ) . MovePosition ( postUpdate ) ;
}
}
@ -4460,7 +4460,7 @@ public class iTween : MonoBehaviour{
postUpdate = thisTransform . eulerAngles ;
if ( physics ) {
thisTransform . eulerAngles = preUpdate ;
rigidbody . MoveRotation ( Quaternion . Euler ( postUpdate ) ) ;
GetComponent < Rigidbody > ( ) . MoveRotation ( Quaternion . Euler ( postUpdate ) ) ;
}
}
@ -4514,7 +4514,7 @@ public class iTween : MonoBehaviour{
postUpdate = thisTransform . position ;
if ( physics ) {
thisTransform . position = preUpdate ;
rigidbody . MovePosition ( postUpdate ) ;
GetComponent < Rigidbody > ( ) . MovePosition ( postUpdate ) ;
}
}
@ -4555,7 +4555,7 @@ public class iTween : MonoBehaviour{
postUpdate = thisTransform . eulerAngles ;
if ( physics ) {
thisTransform . eulerAngles = preUpdate ;
rigidbody . MoveRotation ( Quaternion . Euler ( postUpdate ) ) ;
GetComponent < Rigidbody > ( ) . MoveRotation ( Quaternion . Euler ( postUpdate ) ) ;
}
}
@ -4855,13 +4855,13 @@ public class iTween : MonoBehaviour{
//init values:
if ( target . GetComponent < GUITexture > ( ) ) {
colors [ 0 ] = colors [ 1 ] = target . guiTexture . color ;
colors [ 0 ] = colors [ 1 ] = target . GetComponent < GUITexture > ( ) . color ;
} else if ( target . GetComponent < GUIText > ( ) ) {
colors [ 0 ] = colors [ 1 ] = target . guiText . material . color ;
} else if ( target . renderer ) {
colors [ 0 ] = colors [ 1 ] = target . renderer . material . color ;
} else if ( target . l ight) {
colors [ 0 ] = colors [ 1 ] = target . l ight. color ;
colors [ 0 ] = colors [ 1 ] = target . GetComponent < GUIText > ( ) . material . color ;
} else if ( target . GetComponent < Renderer > ( ) ) {
colors [ 0 ] = colors [ 1 ] = target . GetComponent < Renderer > ( ) . material . color ;
} else if ( target . GetComponent < L ight> ( ) ) {
colors [ 0 ] = colors [ 1 ] = target . GetComponent < L ight> ( ) . color ;
}
//to values:
@ -4890,13 +4890,13 @@ public class iTween : MonoBehaviour{
//apply:
if ( target . GetComponent < GUITexture > ( ) ) {
target . guiTexture . color = colors [ 3 ] ;
target . GetComponent < GUITexture > ( ) . color = colors [ 3 ] ;
} else if ( target . GetComponent < GUIText > ( ) ) {
target . guiText . material . color = colors [ 3 ] ;
} else if ( target . renderer ) {
target . renderer . material . color = colors [ 3 ] ;
} else if ( target . l ight) {
target . l ight. color = colors [ 3 ] ;
target . GetComponent < GUIText > ( ) . material . color = colors [ 3 ] ;
} else if ( target . GetComponent < Renderer > ( ) ) {
target . GetComponent < Renderer > ( ) . material . color = colors [ 3 ] ;
} else if ( target . GetComponent < L ight> ( ) ) {
target . GetComponent < L ight> ( ) . color = colors [ 3 ] ;
}
}
@ -4951,7 +4951,7 @@ public class iTween : MonoBehaviour{
audioSource = ( AudioSource ) args [ "audiosource" ] ;
} else {
if ( target . GetComponent < AudioSource > ( ) ) {
audioSource = target . a udio;
audioSource = target . GetComponent < A udioSource > ( ) ;
} else {
//throw error if no AudioSource is available:
Debug . LogError ( "iTween Error: AudioUpdate requires an AudioSource." ) ;
@ -5072,10 +5072,10 @@ public class iTween : MonoBehaviour{
}
//need physics?
if ( target . rigidbody ! = null ) {
if ( target . GetComponent < Rigidbody > ( ) ! = null ) {
Vector3 postUpdate = target . transform . eulerAngles ;
target . transform . eulerAngles = preUpdate ;
target . rigidbody . MoveRotation ( Quaternion . Euler ( postUpdate ) ) ;
target . GetComponent < Rigidbody > ( ) . MoveRotation ( Quaternion . Euler ( postUpdate ) ) ;
}
}
@ -5281,10 +5281,10 @@ public class iTween : MonoBehaviour{
}
//need physics?
if ( target . rigidbody ! = null ) {
if ( target . GetComponent < Rigidbody > ( ) ! = null ) {
Vector3 postUpdate = target . transform . position ;
target . transform . position = preUpdate ;
target . rigidbody . MovePosition ( postUpdate ) ;
target . GetComponent < Rigidbody > ( ) . MovePosition ( postUpdate ) ;
}
}
@ -6018,7 +6018,7 @@ public class iTween : MonoBehaviour{
/// </param>
public static void CameraFadeSwap ( Texture2D texture ) {
if ( cameraFade ) {
cameraFade . guiTexture . texture = texture ;
cameraFade . GetComponent < GUITexture > ( ) . texture = texture ;
}
}
@ -6042,8 +6042,8 @@ public class iTween : MonoBehaviour{
cameraFade = new GameObject ( "iTween Camera Fade" ) ;
cameraFade . transform . position = new Vector3 ( . 5f , . 5f , depth ) ;
cameraFade . AddComponent < GUITexture > ( ) ;
cameraFade . guiTexture . texture = texture ;
cameraFade . guiTexture . color = new Color ( . 5f , . 5f , . 5f , 0 ) ;
cameraFade . GetComponent < GUITexture > ( ) . texture = texture ;
cameraFade . GetComponent < GUITexture > ( ) . color = new Color ( . 5f , . 5f , . 5f , 0 ) ;
return cameraFade ;
}
}
@ -6065,8 +6065,8 @@ public class iTween : MonoBehaviour{
cameraFade = new GameObject ( "iTween Camera Fade" ) ;
cameraFade . transform . position = new Vector3 ( . 5f , . 5f , Defaults . cameraFadeDepth ) ;
cameraFade . AddComponent < GUITexture > ( ) ;
cameraFade . guiTexture . texture = texture ;
cameraFade . guiTexture . color = new Color ( . 5f , . 5f , . 5f , 0 ) ;
cameraFade . GetComponent < GUITexture > ( ) . texture = texture ;
cameraFade . GetComponent < GUITexture > ( ) . color = new Color ( . 5f , . 5f , . 5f , 0 ) ;
return cameraFade ;
}
}
@ -6085,8 +6085,8 @@ public class iTween : MonoBehaviour{
cameraFade = new GameObject ( "iTween Camera Fade" ) ;
cameraFade . transform . position = new Vector3 ( . 5f , . 5f , Defaults . cameraFadeDepth ) ;
cameraFade . AddComponent < GUITexture > ( ) ;
cameraFade . guiTexture . texture = CameraTexture ( Color . black ) ;
cameraFade . guiTexture . color = new Color ( . 5f , . 5f , . 5f , 0 ) ;
cameraFade . GetComponent < GUITexture > ( ) . texture = CameraTexture ( Color . black ) ;
cameraFade . GetComponent < GUITexture > ( ) . color = new Color ( . 5f , . 5f , . 5f , 0 ) ;
return cameraFade ;
}
}
@ -6828,7 +6828,7 @@ public class iTween : MonoBehaviour{
}
//do we need to use physics, is there a rigidbody?
if ( rigidbody ! = null ) {
if ( GetComponent < Rigidbody > ( ) ! = null ) {
physics = true ;
}