protected void configureTween() { var camera = gameObject.GetComponent<Camera>(); if( this.tween == null ) { this.tween = (TweenShake) camera.ShakePosition( true ) .OnStarted( ( x ) => { onStarted(); } ) .OnStopped( ( x ) => { onStopped(); } ) .OnPaused( ( x ) => { onPaused(); } ) .OnResumed( ( x ) => { onResumed(); } ) .OnLoopCompleted( ( x ) => { onLoopCompleted(); } ) .OnCompleted( ( x ) => { onCompleted(); } ); } this.tween .SetDelay( this.startDelay ) .SetDuration( this.Duration ) .SetShakeMagnitude( this.ShakeMagnitude ) .SetShakeSpeed( this.ShakeSpeed ); }
/// <summary> /// This function should perform all necessary cleanup. It is expected that the [this.tween] /// reference will be NULL after this function completes. /// </summary> protected void cleanup() { if( tween != null ) { tween.Stop(); tween.Release(); tween = null; } }