public void OnStartTweenFinish() { for (int i = 0; i < transform.childCount; i++) { Transform trans = transform.GetChild(i); trans.position = m_bezier.GetBezierValue(.25f * i); trans.GetComponent <UIEventListener>().onDrag += OnDragItem; trans.GetComponent <UIEventListener>().onPress += OnPressItem; trans.GetComponent <UIEventListener>().onClick += OnMenuClick; } }
// Use this for initialization void Start() { m_bezier = gameObject.GetComponent <MUIBezierValue>(); bezierValue = 0; mDelta = 0; for (int i = 0; i < transform.childCount; i++) { Transform trans = transform.GetChild(i); Vector2 pos = m_bezier.GetBezierValue(.25f * i); trans.position = pos; pos = trans.localPosition; trans.localPosition = new Vector3(-500, 0, 0); float duration = 0f; Vector3 scaleValue = Vector3.one; duration = itemDuration[i]; scaleValue = Vector3.one * itemScale[i]; TweenPosition posTween = TweenPosition.Begin(trans.gameObject, duration, pos); posTween.animationCurve = posCurve; TweenScale scaleTween = TweenScale.Begin(trans.gameObject, duration, scaleValue); scaleTween.animationCurve = scaleCurve; if (i == 0) { EventDelegate.Add(scaleTween.onFinished, OnStartTweenFinish, true); } } }