Skip to content

Commit

Permalink
converted spaces to tabs to align with the rest of the project
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcarriere committed Feb 22, 2017
1 parent 075d20d commit 40d6afe
Show file tree
Hide file tree
Showing 15 changed files with 679 additions and 679 deletions.
30 changes: 15 additions & 15 deletions Assets/Plugins/GoKit/Go.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,27 +127,27 @@ private void OnApplicationQuit()
#endregion


/// <summary>
/// this only runs as needed and handles time scale independent Tweens
/// </summary>
private IEnumerator timeScaleIndependentUpdate()
{
/// <summary>
/// this only runs as needed and handles time scale independent Tweens
/// </summary>
private IEnumerator timeScaleIndependentUpdate()
{
_timeScaleIndependentUpdateIsRunning = true;
var time = Time.realtimeSinceStartup;

while( _tweens.Count > 0 )
{
var elapsed = Time.realtimeSinceStartup - time;
time = Time.realtimeSinceStartup;
while( _tweens.Count > 0 )
{
var elapsed = Time.realtimeSinceStartup - time;
time = Time.realtimeSinceStartup;

// update tweens
handleUpdateOfType( GoUpdateType.TimeScaleIndependentUpdate, elapsed );
// update tweens
handleUpdateOfType( GoUpdateType.TimeScaleIndependentUpdate, elapsed );

yield return null;
}
yield return null;
}

_timeScaleIndependentUpdateIsRunning = false;
}
}


/// <summary>
Expand Down Expand Up @@ -250,7 +250,7 @@ public static void error( object format, params object[] paramList )
/// </summary>
public static GoTween to( object target, float duration, GoTweenConfig config )
{
config.setIsTo();
config.setIsTo();
var tween = new GoTween( target, duration, config );
addTween( tween );

Expand Down
2 changes: 1 addition & 1 deletion Assets/Plugins/GoKit/GoProxyProp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ public GoProxyProp( T startValue )
{
value = startValue;
}
}
252 changes: 126 additions & 126 deletions Assets/Plugins/GoKit/GoTween.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,64 +16,64 @@ public sealed class GoTween : AbstractGoTween
private List<AbstractTweenProperty> _tweenPropertyList = new List<AbstractTweenProperty>( 2 );
private Type targetType;

/// <summary>
/// sets the ease type for all Tweens. this will overwrite the ease types for each Tween!
/// </summary>
private GoEaseType _easeType;
public GoEaseType easeType
{
get
{
return _easeType;
}
set
{
_easeType = value;

// change ease type of all existing tweens.
/// <summary>
/// sets the ease type for all Tweens. this will overwrite the ease types for each Tween!
/// </summary>
private GoEaseType _easeType;
public GoEaseType easeType
{
get
{
return _easeType;
}
set
{
_easeType = value;

// change ease type of all existing tweens.
for ( int k = 0; k < _tweenPropertyList.Count; ++k )
{
AbstractTweenProperty tween = _tweenPropertyList[k];
tween.setEaseType (value);
}
}
}

/// <summary>
/// sets the ease curve for all Tweens
/// </summary>
public AnimationCurve easeCurve { get; set; }

/// <summary>
/// initializes a new instance and sets up the details according to the config parameter
/// </summary>
public GoTween( object target, float duration, GoTweenConfig config, Action<AbstractGoTween> onComplete = null )
{
// all tweens must be intialized to have a duration greater than zero. keep in mind that this will ensure
// the tween occurs over two frames: the initialized value, and the final value. if you are looking for a
// tween to reach the end of it's tween immediately, be sure to call complete() on it after creation.
if( duration <= 0 )
{
duration = float.Epsilon;
Debug.LogError( "tween duration must be greater than 0. coerced to float.Epsilon." );
}

// default to removing on complete
autoRemoveOnComplete = true;

// allow events by default
allowEvents = true;

// setup callback bools
_didInit = false;
_didBegin = false;

// flag the onIterationStart event to fire.
// as long as goTo is not called on this tween, the onIterationStart event will fire
// as soon as the delay, if any, is completed.
_fireIterationStart = true;

this.target = target;
}
}

/// <summary>
/// sets the ease curve for all Tweens
/// </summary>
public AnimationCurve easeCurve { get; set; }

/// <summary>
/// initializes a new instance and sets up the details according to the config parameter
/// </summary>
public GoTween( object target, float duration, GoTweenConfig config, Action<AbstractGoTween> onComplete = null )
{
// all tweens must be intialized to have a duration greater than zero. keep in mind that this will ensure
// the tween occurs over two frames: the initialized value, and the final value. if you are looking for a
// tween to reach the end of it's tween immediately, be sure to call complete() on it after creation.
if( duration <= 0 )
{
duration = float.Epsilon;
Debug.LogError( "tween duration must be greater than 0. coerced to float.Epsilon." );
}

// default to removing on complete
autoRemoveOnComplete = true;

// allow events by default
allowEvents = true;

// setup callback bools
_didInit = false;
_didBegin = false;

// flag the onIterationStart event to fire.
// as long as goTo is not called on this tween, the onIterationStart event will fire
// as soon as the delay, if any, is completed.
_fireIterationStart = true;

this.target = target;
this.targetType = target.GetType();
this.duration = duration;

Expand All @@ -88,12 +88,12 @@ public GoTween( object target, float duration, GoTweenConfig config, Action<Abst
isFrom = config.isFrom;
timeScale = config.timeScale;

_onInit = config.onInitHandler;
_onBegin = config.onBeginHandler;
_onIterationStart = config.onIterationStartHandler;
_onUpdate = config.onUpdateHandler;
_onIterationEnd = config.onIterationEndHandler;
_onComplete = config.onCompleteHandler;
_onInit = config.onInitHandler;
_onBegin = config.onBeginHandler;
_onIterationStart = config.onIterationStartHandler;
_onUpdate = config.onUpdateHandler;
_onIterationEnd = config.onIterationEndHandler;
_onComplete = config.onCompleteHandler;

if( config.isPaused )
state = GoTweenState.Paused;
Expand Down Expand Up @@ -127,9 +127,9 @@ public GoTween( object target, float duration, GoTweenConfig config, Action<Abst
/// </summary>
public override bool update( float deltaTime )
{
// properties are prepared only once on the first update of the tween.
if ( !_didInit )
onInit();
// properties are prepared only once on the first update of the tween.
if ( !_didInit )
onInit();

// should we validate the target?
if( Go.validateTargetObjectsEachTick )
Expand All @@ -147,9 +147,9 @@ public override bool update( float deltaTime )
}
}

// we only fire the begin callback once per run.
if ( !_didBegin )
onBegin();
// we only fire the begin callback once per run.
if ( !_didBegin )
onBegin();

// handle delay and return if we are still delaying
if( !_delayComplete && _elapsedDelay < delay )
Expand All @@ -165,29 +165,29 @@ public override bool update( float deltaTime )
return false;
}

// loops only start once the delay has completed.
if ( _fireIterationStart )
onIterationStart();
// loops only start once the delay has completed.
if ( _fireIterationStart )
onIterationStart();

// base will calculate the proper elapsedTime, iterations, etc.
base.update( deltaTime );

// if we are looping back on a PingPong loop
var convertedElapsedTime = _isLoopingBackOnPingPong ? duration - _elapsedTime : _elapsedTime;
//Debug.Log(string.Format("{0} : {1} -- {2}", _elapsedTime, convertedElapsedTime, _isLoopingBackOnPingPong ? "Y" : "N"));
//Debug.Log(string.Format("{0} : {1} -- {2}", _elapsedTime, convertedElapsedTime, _isLoopingBackOnPingPong ? "Y" : "N"));

// update all properties
for( var i = 0; i < _tweenPropertyList.Count; ++i )
_tweenPropertyList[i].tick( convertedElapsedTime );

onUpdate();
onUpdate();

if ( _fireIterationEnd )
onIterationEnd();
if ( _fireIterationEnd )
onIterationEnd();

if( state == GoTweenState.Complete )
{
onComplete();
onComplete();

return true; // true if complete
}
Expand Down Expand Up @@ -262,16 +262,16 @@ public override List<AbstractTweenProperty> allTweenProperties()

#region AbstractTween overrides

/// <summary>
/// called only once the first update of a tween.
/// </summary>
protected override void onInit()
{
base.onInit();
/// <summary>
/// called only once the first update of a tween.
/// </summary>
protected override void onInit()
{
base.onInit();

for ( var i = 0; i < _tweenPropertyList.Count; ++i )
_tweenPropertyList[i].prepareForUse();
}
for ( var i = 0; i < _tweenPropertyList.Count; ++i )
_tweenPropertyList[i].prepareForUse();
}

/// <summary>
/// removes the tween and cleans up its state
Expand All @@ -288,9 +288,9 @@ public override void destroy()
/// goes to the specified time clamping it from 0 to the total duration of the tween. if the tween is
/// not playing it will be force updated to the time specified.
/// </summary>
public override void goTo( float time , bool skipDelay)
{
// handle delay, which is specific to Tweens
public override void goTo( float time , bool skipDelay)
{
// handle delay, which is specific to Tweens
if( skipDelay )
{
_elapsedDelay = delay;
Expand All @@ -303,52 +303,52 @@ public override void goTo( float time , bool skipDelay)

_delayComplete = _elapsedDelay >= delay;

time = Mathf.Clamp( time, 0f, totalDuration );

// provide an early out for calling goto on the same time multiple times.
if ( time == _totalElapsedTime )
return;

// if we are doing a goTo at the "start" of the timeline, based on the isReversed variable,
// allow the onBegin and onIterationStart callback to fire again.
// we only allow the onIterationStart event callback to fire at the start of the timeline,
// as doing a goTo(x) where x % duration == 0 will trigger the onIterationEnd before we
// go to the start.
if ( ( isReversed && time == totalDuration ) || ( !isReversed && time == 0f ) )
{
_didBegin = false;
_fireIterationStart = true;
}
else
{
_didBegin = true;
_fireIterationStart = false;
}

// since we're doing a goTo, we want to stop this tween from remembering that it iterated.
// this could cause issues if you caused the tween to complete an iteration and then goTo somewhere
// else while still paused.
_didIterateThisFrame = false;

// force a time and completedIterations before we update
_totalElapsedTime = time;
_completedIterations = isReversed ? Mathf.CeilToInt( _totalElapsedTime / duration ) : Mathf.FloorToInt( _totalElapsedTime / duration );

update( 0 );
}


/// <summary>
/// completes the tween. sets the object to it's final position as if the tween completed normally.
/// takes into effect if the tween was playing forward or reversed.
/// </summary>
time = Mathf.Clamp( time, 0f, totalDuration );

// provide an early out for calling goto on the same time multiple times.
if ( time == _totalElapsedTime )
return;

// if we are doing a goTo at the "start" of the timeline, based on the isReversed variable,
// allow the onBegin and onIterationStart callback to fire again.
// we only allow the onIterationStart event callback to fire at the start of the timeline,
// as doing a goTo(x) where x % duration == 0 will trigger the onIterationEnd before we
// go to the start.
if ( ( isReversed && time == totalDuration ) || ( !isReversed && time == 0f ) )
{
_didBegin = false;
_fireIterationStart = true;
}
else
{
_didBegin = true;
_fireIterationStart = false;
}

// since we're doing a goTo, we want to stop this tween from remembering that it iterated.
// this could cause issues if you caused the tween to complete an iteration and then goTo somewhere
// else while still paused.
_didIterateThisFrame = false;

// force a time and completedIterations before we update
_totalElapsedTime = time;
_completedIterations = isReversed ? Mathf.CeilToInt( _totalElapsedTime / duration ) : Mathf.FloorToInt( _totalElapsedTime / duration );

update( 0 );
}


/// <summary>
/// completes the tween. sets the object to it's final position as if the tween completed normally.
/// takes into effect if the tween was playing forward or reversed.
/// </summary>
public override void complete()
{
if( iterations < 0 )
return;

// set delayComplete so we get one last update in before we die (base will set the elapsed time for us)
_delayComplete = true;
// set delayComplete so we get one last update in before we die (base will set the elapsed time for us)
_delayComplete = true;

base.complete();
}
Expand Down

0 comments on commit 40d6afe

Please sign in to comment.