/// <summary> /// Flag a Tweener that implements IAutoKillableTweener to be auto killed if another tween targeting the same object is played. /// Until the Tweener is either killed, or finished, it will be eligible for being automatically /// killed if another Tweener starts playing that tweens the same target object. Note that other tweener /// must implement IAutoKillableTweener as well (though doesn't have to be flagged to AutoKill). /// </summary> /// <param name="tween"></param> public static void AutoKill(Tweener tween) { if (tween == null) { throw new System.ArgumentNullException("tween"); } if (tween.Id == null) { throw new System.ArgumentException("Can only register a Tweener with a valid 'Id' for autokill."); } if (GameLoopEntry.ApplicationClosing) { return; } if (!tween.IsPlaying) { throw new System.ArgumentException("Can only register a playing Tweener for autokill."); } if (_instance == null) { _instance = Singleton.CreateSpecialInstance <SPTween>(SPECIAL_NAME, SingletonLifeCycleRule.LivesForever); } var token = new TokenPairing(tween.Id, tween.AutoKillToken); Tweener old; if (_autoKillDict.TryGetValue(token, out old) && old != tween) { old.Kill(); } _autoKillDict[token] = tween; }
/// <summary> /// Flag a Tweener that implements IAutoKillableTweener to be auto killed if another tween targeting the same object is played. /// Until the Tweener is either killed, or finished, it will be eligible for being automatically /// killed if another Tweener starts playing that tweens the same target object. Note that other tweener /// must implement IAutoKillableTweener as well (though doesn't have to be flagged to AutoKill). /// </summary> /// <param name="tween"></param> public static void AutoKill(Tweener tween) { if (tween == null || !(tween is IAutoKillableTweener)) return; if (GameLoopEntry.ApplicationClosing) return; if (_instance == null) _instance = Singleton.CreateSpecialInstance<SPTween>(SPECIAL_NAME, true); _instance.AutoKill_Imp(tween as IAutoKillableTweener); }
Tweener ITweenHash.Play(float playHeadPosition, bool autoKill, object autoKillToken) { this.Play(playHeadPosition); if (autoKill) { this.AutoKillToken = autoKillToken; SPTween.AutoKill(this); } return(this); }
Tweener ITweenHash.Play(bool autoKill, object autoKillToken) { this.Play(); if (autoKill) { this.AutoKillToken = autoKillToken; SPTween.AutoKill(this); } return(this); }
internal static void AddReference(Tweener tween) { if (GameLoopEntry.ApplicationClosing) { return; } if (_instance == null) { _instance = Singleton.CreateSpecialInstance <SPTween>(SPECIAL_NAME, SingletonLifeCycleRule.LivesForever); } _instance.AddReference_Imp(tween); }
public virtual void Stop() { if (!_isPlaying) { return; } _isPlaying = false; SPTween.RemoveReference(this); if (this.OnStopped != null) { this.OnStopped(this, System.EventArgs.Empty); } }
public virtual void Play(float playHeadPosition) { if (this.IsDead) { throw new System.InvalidOperationException("Cannot play a dead Tweener."); } if (!_isPlaying) { _isPlaying = true; _playHeadLength = this.GetPlayHeadLength(); SPTween.AddReference(this); } _unwrappedPlayHeadPosition = playHeadPosition; _normalizedPlayHeadPosition = playHeadPosition; }
public Tweener Play(float playHeadPos, bool autoKill, object autoKillToken = null) { if (_targ == null) { return(null); } var tween = this.Create(); if (autoKill) { tween.AutoKillToken = autoKillToken; tween.Play(playHeadPos); SPTween.AutoKill(tween); } else { tween.Play(playHeadPos); } return(tween); }
public Tweener Play(bool autoKill, object autoKillToken = null) { if (_targ == null) { return(null); } var tween = this.Create(); if (autoKill) { tween.AutoKillToken = autoKillToken; tween.Play(); if (tween.IsPlaying) { SPTween.AutoKill(tween); } } else { tween.Play(); } return(tween); }
public virtual void Kill() { SPTween.RemoveReference(this); this.SetKilled(); }
internal static void AddReference(Tweener tween) { if (GameLoopEntry.ApplicationClosing) return; if (_instance == null) _instance = Singleton.CreateSpecialInstance<SPTween>(SPECIAL_NAME, true); _instance.AddReference_Imp(tween); }