Skip to content

Commit

Permalink
Added tag property to AbstractGoTween.cs. Then added removeTweenWithT…
Browse files Browse the repository at this point in the history
…ag and tweensWithTag methods to Go.cs in order to allow the manipulation of currently active tweens via the tag property.
  • Loading branch information
Ryan Goodrich authored and Ryan Goodrich committed Apr 11, 2015
1 parent 28a5d2d commit 5aa6a4a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
33 changes: 33 additions & 0 deletions Assets/Plugins/GoKit/Go.cs
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,39 @@ public static bool removeTween( AbstractGoTween tween )
return false;
}

/// <summary>
/// removes the Tween with specific tag
/// </summary>
public static void removeTweenWithTag( string tag )
{
List<AbstractGoTween> tweenList = tweensWithTag( tag );
if( tweenList != null )
{
foreach( var tween in tweenList )
{
removeTween( tween );
}
}
}

/// <summary>
/// returns a list of all Tweens, TweenChains and TweenFlows with the given tag
/// </summary>
public static List<AbstractGoTween> tweensWithTag( string tag )
{
List<AbstractGoTween> list = null;
foreach( var tween in _tweens )
{
if( tween.tag == tag )
{
if( list == null )
list = new List<AbstractGoTween>();
list.Add( tween );
}
}

return list;
}

/// <summary>
/// returns a list of all Tweens, TweenChains and TweenFlows with the given id
Expand Down
3 changes: 2 additions & 1 deletion Assets/Plugins/GoKit/base/AbstractGoTween.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
/// </summary>
public abstract class AbstractGoTween
{
public int id = 0; // optional id used for identifying this tween
public int id { get; set; } // optional id used for identifying this tween
public string tag { get; set; } // optional tag used for identifying this tween
public GoTweenState state { get; protected set; } // current state of the tween
public float duration { get; protected set; } // duration for a single loop
public float totalDuration { get; protected set; } // duration for all loops of this tween
Expand Down

0 comments on commit 5aa6a4a

Please sign in to comment.