} //END ForceDefaults //--------------------------------------------// public override void Play() //--------------------------------------------// { base.Play(); if( currentAnimationCounter >= rotationsToAnimateTo.Length ) { //Debug.Log( "Resetting animation counter... because counter( " + currentAnimationCounter + " ) >= rotations.Length( " + rotationsToAnimateTo.Length + " )" ); currentAnimationCounter = 0; } UnityEvent _event = new UnityEvent(); _event.AddListener( Play ); for( int i = 0; i < transformsToAnimate.Length; i++ ) { bxrTween tween = transformsToAnimate[ i ].Rotate( rotationsToAnimateTo[ currentAnimationCounter ], animationSpeeds[ currentAnimationCounter ], easeTypes[ currentAnimationCounter ], transformsToAnimate[ i ].localEulerAngles, delays[ currentAnimationCounter ], false, _event ); tween.PreventDestroyOnComplete(); tweens.Add( tween ); } //Debug.Log( "Play() counter = " + currentAnimationCounter + ", rotations.Length = " + rotationsToAnimateTo.Length + ", rotation = " + rotationsToAnimateTo[ currentAnimationCounter ] ); currentAnimationCounter++; } //END Play
} //END ForceDefaults //--------------------------------------------// public override void Play() //--------------------------------------------// { base.Play(); if( currentAnimationCounter >= scalesToAnimateTo.Length ) { currentAnimationCounter = 0; } UnityEvent _event = new UnityEvent(); _event.AddListener( Play ); if( transformsToAnimate != null ) { foreach( Transform _transform in transformsToAnimate ) { if( _transform != null ) { bxrTween tween = _transform.Scale( scalesToAnimateTo[ currentAnimationCounter ], animationSpeeds[ currentAnimationCounter ], easeTypes[ currentAnimationCounter ], _transform.localScale, delays[ currentAnimationCounter ], false, _event ); tween.PreventDestroyOnComplete(); tweens.Add( tween ); } } } currentAnimationCounter++; } //END Play
} //END RemoveExistingComponent //----------------------------------------------// private void AddNewComponent() //----------------------------------------------// { //If we're adding a new tween via this event, create the tween and attach it to this gameObject for easy editing if( action == Action.CreateTween ) { if( action == Action.None ) { return; } string newComponentName = "BrandXR.bxrTween" + tweenType.ToString(); Type componentType = ComponentHelper.FindType( newComponentName ); //showDebug = true; if( showDebug ) { Debug.Log( "BlockEventTween.cs AddNewComponent() name = " + newComponentName + ", Type = " + componentType ); } tween = (bxrTween)gameObject.AddComponent( componentType ); } } //END AddNewComponent
} //END Stop //--------------------------------------------// private void Kill() //--------------------------------------------// { if( tweens != null && tweens.Count > 0 ) { //Loop through the tween in reverse and remove them for( int i = tweens.Count - 1; i >= 0; i-- ) { if( tweens[i] != null ) { bxrTween tween = tweens[ i ]; tweens.Remove( tween ); tween.Kill(); } } } } //END Kill
} //END ForceDefaults //--------------------------------------------// public override void Play() //--------------------------------------------// { base.Play(); if( currentAnimationCounter >= positionsToAnimateTo.Length ) { currentAnimationCounter = 0; } UnityEvent _event = new UnityEvent(); _event.AddListener( Play ); foreach( Transform _transform in transformsToAnimate ) { bxrTween tween = _transform.Move( positionsToAnimateTo[ currentAnimationCounter ], animationSpeeds[ currentAnimationCounter ], easeTypes[ currentAnimationCounter ], _transform.localPosition, bxrTweenPosition.LocalOrWorldSpace.Local, 0f, false, _event ); tween.PreventDestroyOnComplete(); tweens.Add( tween ); } currentAnimationCounter++; } //END Play
} //END ForceDefaults //--------------------------------------------// public override void Play() //--------------------------------------------// { base.Play(); if( currentAnimationCounter >= colorsToAnimateTo.Length ) { currentAnimationCounter = 0; } UnityEvent _event = new UnityEvent(); _event.AddListener( Play ); if( rendererType == bxrTweenColor.RendererType.Renderer ) { foreach( Renderer renderer in renderers ) { bxrTween tween = renderer.Color( colorsToAnimateTo[ currentAnimationCounter ], animationSpeeds[ currentAnimationCounter ], easeTypes[ currentAnimationCounter ], renderer.sharedMaterial.color, delays[ currentAnimationCounter ], false, _event ); tween.PreventDestroyOnComplete(); tweens.Add( tween ); } } else if( rendererType == bxrTweenColor.RendererType.Image ) { foreach( Image renderer in images ) { bxrTween tween = renderer.Color( colorsToAnimateTo[ currentAnimationCounter ], animationSpeeds[ currentAnimationCounter ], easeTypes[ currentAnimationCounter ], renderer.color, delays[ currentAnimationCounter ], false, _event ); tween.PreventDestroyOnComplete(); tweens.Add( tween ); } } else if( rendererType == bxrTweenColor.RendererType.RawImage ) { foreach( RawImage renderer in rawImages ) { bxrTween tween = renderer.Color( colorsToAnimateTo[ currentAnimationCounter ], animationSpeeds[ currentAnimationCounter ], easeTypes[ currentAnimationCounter ], renderer.color, delays[ currentAnimationCounter ], false, _event ); tween.PreventDestroyOnComplete(); tweens.Add( tween ); } } else if( rendererType == bxrTweenColor.RendererType.SpriteRenderer ) { foreach( SpriteRenderer renderer in spriteRenderers ) { bxrTween tween = renderer.Color( colorsToAnimateTo[ currentAnimationCounter ], animationSpeeds[ currentAnimationCounter ], easeTypes[ currentAnimationCounter ], renderer.color, delays[ currentAnimationCounter ], false, _event ); tween.PreventDestroyOnComplete(); tweens.Add( tween ); } } else if( rendererType == bxrTweenColor.RendererType.Text ) { foreach( Text renderer in texts ) { bxrTween tween = renderer.Color( colorsToAnimateTo[ currentAnimationCounter ], animationSpeeds[ currentAnimationCounter ], easeTypes[ currentAnimationCounter ], renderer.color, delays[ currentAnimationCounter ], false, _event ); tween.PreventDestroyOnComplete(); tweens.Add( tween ); } } else if( rendererType == bxrTweenColor.RendererType.Material ) { foreach( Material renderer in materials ) { bxrTween tween = renderer.Color( colorsToAnimateTo[ currentAnimationCounter ], animationSpeeds[ currentAnimationCounter ], easeTypes[ currentAnimationCounter ], renderer.color, delays[ currentAnimationCounter ], false, _event ); tween.PreventDestroyOnComplete(); tweens.Add( tween ); } } else if( rendererType == bxrTweenColor.RendererType.CanvasGroup ) { foreach( CanvasGroup renderer in canvasGroups ) { bxrTween tween = renderer.Color( colorsToAnimateTo[ currentAnimationCounter ], animationSpeeds[ currentAnimationCounter ], easeTypes[ currentAnimationCounter ], new Color( Color.white.r, Color.white.g, Color.white.b, renderer.alpha ), delays[ currentAnimationCounter ], false, _event ); tween.PreventDestroyOnComplete(); tweens.Add( tween ); } } currentAnimationCounter++; } //END Play