float Prepend(IHOTweenComponent p_twMember, float p_duration) { if (items == null) { return(Insert(0, p_twMember)); } if (p_twMember != null) { HOTween.RemoveFromTweens(p_twMember); ((ABSTweenComponent)p_twMember).contSequence = this; CheckSpeedBasedTween(p_twMember); } HOTSeqItem newItem = (p_twMember != null ? new HOTSeqItem(0, p_twMember as ABSTweenComponent) : new HOTSeqItem(0, p_duration)); float itemDur = newItem.duration; int itemsCount = items.Count; for (int i = 0; i < itemsCount; ++i) { items[i].startTime += itemDur; } items.Insert(0, newItem); _duration += itemDur; SetFullDuration(); _isEmpty = false; return(_duration); }
/// <summary> /// If the given <see cref="IHOTweenComponent"/> is a speedBased <see cref="Tweener"/>, /// forces it to calculate the correct duration. /// </summary> static void CheckSpeedBasedTween(IHOTweenComponent p_twMember) { Tweener tw = p_twMember as Tweener; if (tw != null && tw._speedBased) { tw.ForceSetSpeedBasedDuration(); } }
float Insert(float p_time, IHOTweenComponent p_twMember, float p_duration) { if (p_twMember != null) { HOTween.RemoveFromTweens(p_twMember); ((ABSTweenComponent)p_twMember).contSequence = this; CheckSpeedBasedTween(p_twMember); } HOTSeqItem newItem = (p_twMember != null ? new HOTSeqItem(p_time, p_twMember as ABSTweenComponent) : new HOTSeqItem(p_time, p_duration)); if (items == null) { items = new List <HOTSeqItem> { newItem }; _duration = newItem.startTime + newItem.duration; SetFullDuration(); _isEmpty = false; return(_duration); } bool placed = false; int itemsCount = items.Count; for (int i = 0; i < itemsCount; ++i) { if (items[i].startTime >= p_time) { items.Insert(i, newItem); placed = true; break; } } if (!placed) { items.Add(newItem); } _duration = Mathf.Max(newItem.startTime + newItem.duration, _duration); SetFullDuration(); _isEmpty = false; return(_duration); }
public override void OnEnter() { List <IHOTweenComponent> tweens = new List <IHOTweenComponent>(); tweens = HOTween.GetTweensById(tweenID.Value, false); if (tweens.Count == 0) { LogWarning("HOTween " + tweenID.Value + " not found"); Fsm.Event(failed); Finish(); return; } else { tween = tweens[0]; tween.Kill(); Finish(); } }
float Append(IHOTweenComponent p_twMember, float p_duration) { if (items == null) { return(p_twMember != null ? Insert(0, p_twMember) : Insert(0, null, p_duration)); } if (p_twMember != null) { HOTween.RemoveFromTweens(p_twMember); ((ABSTweenComponent)p_twMember).contSequence = this; CheckSpeedBasedTween(p_twMember); } HOTSeqItem newItem = (p_twMember != null ? new HOTSeqItem(_duration, p_twMember as ABSTweenComponent) : new HOTSeqItem(_duration, p_duration)); items.Add(newItem); _duration += newItem.duration; SetFullDuration(); _isEmpty = false; return(_duration); }
float Prepend(IHOTweenComponent p_twMember, float p_duration) { if (items == null) { return Insert(0, p_twMember); } if (p_twMember != null) { HOTween.RemoveFromTweens(p_twMember); ((ABSTweenComponent)p_twMember).contSequence = this; CheckSpeedBasedTween(p_twMember); } HOTSeqItem newItem = (p_twMember != null ? new HOTSeqItem(0, p_twMember as ABSTweenComponent) : new HOTSeqItem(0, p_duration)); float itemDur = newItem.duration; int itemsCount = items.Count; for (int i = 0; i < itemsCount; ++i) { items[i].startTime += itemDur; } items.Insert(0, newItem); _duration += itemDur; SetFullDuration(); _isEmpty = false; return _duration; }
float Append(IHOTweenComponent p_twMember, float p_duration) { if (items == null) { return (p_twMember != null ? Insert(0, p_twMember) : Insert(0, null, p_duration)); } if (p_twMember != null) { HOTween.RemoveFromTweens(p_twMember); ((ABSTweenComponent)p_twMember).contSequence = this; CheckSpeedBasedTween(p_twMember); } HOTSeqItem newItem = (p_twMember != null ? new HOTSeqItem(_duration, p_twMember as ABSTweenComponent) : new HOTSeqItem(_duration, p_duration)); items.Add(newItem); _duration += newItem.duration; SetFullDuration(); _isEmpty = false; return _duration; }
/// <summary> /// Adds the given <see cref="IHOTweenComponent"/> to the left of the sequence, /// moving all the existing sequence elements to the right, /// and returns the new Sequence total time length (loops excluded). /// </summary> /// <param name="p_twMember"> /// The <see cref="IHOTweenComponent"/> to prepend. /// </param> /// <returns> /// The new Sequence total time length (loops excluded). /// </returns> public float Prepend(IHOTweenComponent p_twMember) { return Prepend(p_twMember, 0); }
public HOTSequence Insert(float time, IHOTweenComponent tween) { sequenceOps.Add(new SequenceOp(time, tween)); return(this); }
internal TweenEvent(IHOTweenComponent p_tween, object[] p_parms, ABSTweenPlugin p_plugin) { _tween = p_tween; _parms = p_parms; _plugin = p_plugin; }
public HOTSequence Prepend(IHOTweenComponent tween) { sequenceOps.Add(new SequenceOp(SequenceOp.OpType.Prepend, tween)); return(this); }
/// <summary> /// Inserts the given <see cref="IHOTweenComponent"/> at the given time, /// and returns the new Sequence total time length (loops excluded). /// </summary> /// <param name="p_time"> /// The time at which the element must be placed. /// </param> /// <param name="p_twMember"> /// The <see cref="IHOTweenComponent"/> to insert. /// </param> /// <returns> /// The new Sequence total time length (loops excluded). /// </returns> public float Insert(float p_time, IHOTweenComponent p_twMember) { return(Insert(p_time, p_twMember, 0)); }
// *********************************************************************************** // CONSTRUCTOR // *********************************************************************************** internal TweenEvent(IHOTweenComponent p_tween, object[] p_parms) { _tween = p_tween; _parms = p_parms; _plugin = null; }
/// <summary> /// Inserts the given <see cref="IHOTweenComponent"/> at the given time, /// and returns the new Sequence total time length (loops excluded). /// </summary> /// <param name="p_time"> /// The time at which the element must be placed. /// </param> /// <param name="p_twMember"> /// The <see cref="IHOTweenComponent"/> to insert. /// </param> /// <returns> /// The new Sequence total time length (loops excluded). /// </returns> public float Insert(float p_time, IHOTweenComponent p_twMember) { return Insert(p_time, p_twMember, 0); }
public SequenceOp(OpType type, IHOTweenComponent tween) { this.time = -1f; this.type = type; this.opObject = tween; }
public SequenceOp(float time, IHOTweenComponent tween) { this.type = OpType.Insert; this.time = time; this.opObject = tween; }
float Insert(float p_time, IHOTweenComponent p_twMember, float p_duration) { if (p_twMember != null) { HOTween.RemoveFromTweens(p_twMember); ((ABSTweenComponent)p_twMember).contSequence = this; CheckSpeedBasedTween(p_twMember); } HOTSeqItem newItem = (p_twMember != null ? new HOTSeqItem(p_time, p_twMember as ABSTweenComponent) : new HOTSeqItem(p_time, p_duration)); if (items == null) { items = new List<HOTSeqItem> { newItem }; _duration = newItem.startTime + newItem.duration; SetFullDuration(); _isEmpty = false; return _duration; } bool placed = false; int itemsCount = items.Count; for (int i = 0; i < itemsCount; ++i) { if (items[i].startTime >= p_time) { items.Insert(i, newItem); placed = true; break; } } if (!placed) { items.Add(newItem); } _duration = Mathf.Max(newItem.startTime + newItem.duration, _duration); SetFullDuration(); _isEmpty = false; return _duration; }
/// <summary> /// Adds the given <see cref="IHOTweenComponent"/> to the left of the sequence, /// moving all the existing sequence elements to the right, /// and returns the new Sequence total time length (loops excluded). /// </summary> /// <param name="p_twMember"> /// The <see cref="IHOTweenComponent"/> to prepend. /// </param> /// <returns> /// The new Sequence total time length (loops excluded). /// </returns> public float Prepend(IHOTweenComponent p_twMember) { return(Prepend(p_twMember, 0)); }
public override void OnEnter() { // var goTarget = Fsm.GetOwnerDefaultTarget(target); List <IHOTweenComponent> tweens = new List <IHOTweenComponent>(); /* * if (goTarget != null) * { * Debug.Log("looking for tweens by target :"+goTarget.name); * List<Tweener> tweeners = HOTween. .GetTweenersByTarget(goTarget.transform,true); * foreach (Tweener tweener in tweeners) * { * Debug.Log(tweener.id+ " "+tweenID.Value); * * if (string.Equals(tweener.id,tweenID.Value)) * { * tweens.Add(tweener); * } * } * }else{ * * tweens = HOTween.GetTweensById(tweenID.Value,false); * * } */ tweens = HOTween.GetTweensById(tweenID.Value, false); if (tweens.Count == 0) { LogWarning("HOTween " + tweenID.Value + " not found"); Fsm.Event(failed); Finish(); return; } else { tween = tweens[0]; tween.autoKillOnComplete = false; if (tween.isComplete) { if (startAction == OnStartAction.RewindIfCompleted || startAction == OnStartAction.alwaysRewind) { tween.Rewind(); } } if (tween.hasStarted) { if (startAction == OnStartAction.RewindIfPlaying || startAction == OnStartAction.alwaysRewind) { tween.Rewind(); } } if (playType == PlayType.playForward) { tween.PlayForward(); } else if (playType == PlayType.playBackward) { tween.PlayBackwards(); } else { tween.Play(); } } if (completed == null) { Debug.Log("finished"); Finish(); } else { if (tween.loops == -1 && completed != null) { LogWarning("tween " + tweenID.Value + " is looping to infinite, the completed event will never be fired"); } } }
/// <summary> /// Used by Sequences to remove added tweens from main tweens list. /// </summary> /// <param name="p_tween"></param> internal static void RemoveFromTweens(IHOTweenComponent p_tween) { if (tweens == null) return; int tweensCount = tweens.Count; for (int i = 0; i < tweensCount; ++i) { if (tweens[i] == p_tween) { tweens.RemoveAt(i); break; } } }