void Update() { //左移标记被激活,做左移操作 if (movingLeft) { Time.timeScale = 1; int temp = -(int)currentList - 1; float distance = Vector2.Distance(m_BGList.localPosition, new Vector2(temp * SenceLength + 15, 0)); m_BGList.localPosition = Vector2.Lerp(m_BGList.localPosition, new Vector2(temp * SenceLength + 15, 0), SenceLength * 2.5f / distance * Time.deltaTime); if (m_BGList.localPosition == new Vector3(temp * SenceLength + 15, 0)) { movingLeft = false; currentList = (SHOWLIST)((int)currentList + 1); SetCurrentListActive(); } } //右移标记被激活,做右移操作 if (movingRight) { Time.timeScale = 1; int temp = -(int)currentList + 1; float distance = Vector2.Distance(m_BGList.localPosition, new Vector2(temp * SenceLength + 15, 0)); m_BGList.localPosition = Vector2.Lerp(m_BGList.localPosition, new Vector2(temp * SenceLength + 15, 0), SenceLength * 2.5f / distance * Time.deltaTime); if (m_BGList.localPosition == new Vector3(temp * SenceLength + 15, 0)) { movingRight = false; currentList = (SHOWLIST)((int)currentList - 1); SetCurrentListActive(); } } }