Unfolding the dynamics of ecosystems undergoing alternating wet-dry transitional states