Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IEnumerator DragNach(float _target, float _time)
- {
- float _t = 0f;
- while (_t<1)
- {
- _t += Time.deltaTime/_time;
- sr.horizontalNormalizedPosition = Mathf.Lerp(sr.horizontalNormalizedPosition,_target,_t);
- yield return null;
- }
- if (_target <= 0.1) transform.GetChild(2).SetAsFirstSibling(); else if (_target >= 0.9) transform.GetChild(0).SetAsLastSibling();
- sr.horizontalNormalizedPosition = .5f;
- }
- public void OnEndDragging()
- {
- StartCoroutine(DragNach(Mathf.Round(sr.horizontalNormalizedPosition * 2f) * .5f, .2f));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement