public void BeginTween(TweenBase tween) { Assert.IsTrue(!tween.isRunning); if (tween.includeChildren) { // Clone and apply this tween to all children. for (var i = 0; i < tween.owner.transform.childCount; i++) { var child = tween.owner.transform.GetChild(i); var new_tween = TweenHelper.CloneAndApplyTo(tween, child.gameObject); BeginTween(new_tween); } } tweens_.Add(tween); if (tween.owner != null) { if (!tweens_obj_map_.ContainsKey(tween.owner)) { tweens_obj_map_[tween.owner] = new List <TweenBase>(); } tweens_obj_map_[tween.owner].Add(tween); } if (!string.IsNullOrEmpty(tween.name)) { if (!tweens_name_map_.ContainsKey(tween.name)) { tweens_name_map_[tween.name] = new List <TweenBase>(); } tweens_name_map_[tween.name].Add(tween); } tweens_id_map_.Add(tween.uniqueId, tween); tween.OnStart(this); }
public void FinishAll(IEnumerable <TweenBase> tweens) { Queue <KeyValuePair <TweenBase, float> > queue = new Queue <KeyValuePair <TweenBase, float> >(); foreach (var tween in tweens) { queue.Enqueue(Util.MakePair(tween, float.MaxValue)); } TweenHelper.UpdateQueue(queue, this); }
private void UpdateWithDelta(float deltaTime, float unscaledDeltaTime) { Queue <KeyValuePair <TweenBase, float> > queue = new Queue <KeyValuePair <TweenBase, float> >(); foreach (var tween in tweens_) { queue.Enqueue( Util.MakePair(tween, tween.ignoreTimeScale ? unscaledDeltaTime : deltaTime)); } TweenHelper.UpdateQueue(queue, this); }
public void FinishAll(GameObject owner) { if (tweens_obj_map_.ContainsKey(owner)) { Queue <KeyValuePair <TweenBase, float> > queue = new Queue <KeyValuePair <TweenBase, float> >(); foreach (var tween in tweens_obj_map_[owner]) { queue.Enqueue(Util.MakePair(tween, float.MaxValue)); } TweenHelper.UpdateQueue(queue, this); } }
internal override bool OnUpdate(float delta_time, out float remain_time) { while (true) { Queue <KeyValuePair <TweenBase, float> > queue = new Queue <KeyValuePair <TweenBase, float> >(); foreach (var tween in running_tweens_) { queue.Enqueue( Util.MakePair(tween, delta_time)); } float minRemainTime = TweenHelper.UpdateQueue(queue, this); if (running_tweens_.Count == 0) { if ((--repeat_cnt_dynamic_) == 0) { remain_time = minRemainTime; return(true); } else { delta_time = minRemainTime; Restart(); } } else { break; } } remain_time = 0; now_time_ += delta_time; if (timeLimit > 0 && now_time_ >= timeLimit) { remain_time = now_time_ - timeLimit; if (finishAllWhenTimeout) { Finish(); } else { Cancel(); } return(true); } else { remain_time = 0; return(false); } }
public bool FinishTween(TweenBase tween) { if (running_tweens_.Contains(tween) && tween.isRunning) { Queue <KeyValuePair <TweenBase, float> > queue = new Queue <KeyValuePair <TweenBase, float> >(); queue.Enqueue(Util.MakePair(tween, float.MaxValue)); TweenHelper.UpdateQueue(queue, this); return(true); } else { return(false); } }
public bool FinishTween(TweenBase tween) { if (tweens_.Contains(tween) && tween.isRunning) { Queue <KeyValuePair <TweenBase, float> > queue = new Queue <KeyValuePair <TweenBase, float> >(); queue.Enqueue(Util.MakePair(tween, float.MaxValue)); TweenHelper.UpdateQueue(queue, this); return(true); } else { Debug.LogWarning("[Box.Tween] tween is not running in this handler!"); return(false); } }
public void BeginTween(TweenBase tween) { Assert.IsTrue(!tween.isRunning); if (tween.includeChildren) { // Clone and apply this tween to all children. for (var i = 0; i < tween.owner.transform.childCount; i++) { var child = tween.owner.transform.GetChild(i); var new_tween = TweenHelper.CloneAndApplyTo(tween, child.gameObject); BeginTween(new_tween); } } running_tweens_.Add(tween); tween.OnStart(this); }