void Move() { if (m_MovingTop) { m_SpaceshipBehaviour.MoveTranslate(new Vector3(m_VerticalSpeed * Time.deltaTime, 0, 0)); } else { m_SpaceshipBehaviour.MoveTranslate(new Vector3(-m_VerticalSpeed * Time.deltaTime, 0, 0)); } m_SpaceshipBehaviour.MoveTranslate(new Vector3(0, -m_HorizontalSpeed * Time.deltaTime, 0)); if (transform.position.y >= m_TopLimit) { m_MovingTop = false; } if (transform.position.y <= m_BottomLimit) { m_MovingTop = true; } }