public void Build(string goName, bool autoKill, UpdateType updateType) { if(mSequence != null) { HOTween.Kill(mSequence); mInsertActionTrack = null; mActionTween = null; } mSequence = new Sequence( new SequenceParms() .Id(string.Format("{0}:{1}", goName, mTake.name)) .UpdateType(updateType) .AutoKill(autoKill) .Loops(mTake.numLoop, mTake.loopMode) .OnComplete(OnSequenceComplete)); mTake.maintainCaches(mTarget); float minWaitTime = float.MaxValue; List<List<AMActionData>> trackValueSets = null; foreach(AMTrack track in mTake.trackValues) { Object tgt = null; if((tgt = track.GetTarget(mTarget)) != null) { track.buildSequenceStart(this); int keyMax = track.keys.Count; if(keyMax > 0) { for(int keyInd = 0; keyInd < keyMax; keyInd++) { AMKey key = track.keys[keyInd]; key.build(this, track, keyInd, tgt); } float waitTime = track.keys[0].getWaitTime(mTake.frameRate, 0.0f); if(waitTime < minWaitTime) minWaitTime = waitTime; } //check to see if we have value sets for this track if(mInsertActionTrack != null) { if(trackValueSets == null) trackValueSets = new List<List<AMActionData>>(); trackValueSets.Add(mInsertActionTrack); mInsertActionTrack = null; } } } //build the value track mInsertActionTrack = null; if(trackValueSets != null && trackValueSets.Count > 0) { mActionTween = new AMActionTween(trackValueSets); mSequence.Insert(mActionTween.startTime, HOTween.To(this, mActionTween.duration, new TweenParms().Prop("id", mActionTween))); } //prepend delay at the beginning if(minWaitTime > 0.0f) mSequence.PrependInterval(minWaitTime); }
/// <summary> /// Only call this during OnDestroy /// </summary> public void Destroy() { if(mSequence != null) { HOTween.Kill(mSequence); mSequence = null; } mActionTween = null; mTarget = null; mTake = null; }