/// <summary> /// Use to get a group end time with counting group repeats. /// </summary> public float GetGroupTotalTime(LeanTweenGroup group) { int loops = 1; if (group.doesLoop) { loops = group.loopCount < 1 ? defaultLoopCount : group.loopCount; } return((GetGroupEndTime(group) * loops) + (group.loopDelay * (loops - 1)) + group.delay); }
// Instantiates LeanTweenGroup by making a copy of group. // <param name="group">Group.</param> public LeanTweenGroup(LeanTweenGroup group) { groupName = group.groupName; delay = group.delay; foldout = group.foldout; itemList.Clear(); foreach (LeanTweenItem item in group.itemList) { itemList.Add(new LeanTweenItem(item)); } }
public void BuildGroup(object g) { LeanTweenGroup group = (LeanTweenGroup)g; if (isSimulating) { if (group.loopCount < 1) { group.loopCount = defaultLoopCount; groupsWithInfiniteLoops.Add(group); } } if (group.gameObject == null) { group.gameObject = gameObject; } if (group.overrideGameObject != null) { group.gameObject = group.overrideGameObject; } foreach (LeanTweenItem item in group.itemList) { if (group.overrideGameObject != null) { item.gameObject = group.overrideGameObject; } if (isSimulating) { BuildTween(item, group.delay, false, resetPath); } else { BuildTween(item, group.delay, group.GenerateCode, resetPath); } } if ((!group.GenerateCode || isSimulating) && group.doesLoop && (group.loopCount < 0 || group.loopIter < group.loopCount - 1)) { LeanTween.DelayedCall(group.gameObject, GetGroupEndTime(group), BuildGroup).SetOnCompleteParam(group).SetDelay(group.loopDelay); group.loopIter++; } }
/// <summary> /// Use to get a group end time withot counting group repeats /// </summary> public float GetGroupEndTime(LeanTweenGroup group) { float maxTime = 0; for (int i = 0; i < group.itemList.Count; i++) { if (i == 0) { maxTime = GetItemTotalTime(group.itemList[i]); } else { float atualTime = GetItemTotalTime(group.itemList[i]); if (atualTime > maxTime) { maxTime = atualTime; } } } return(maxTime); }