Of course you could add extra constraints to the jump functions if such as if its actually colliding with the ground by adding a tag and then using gameObject.CompareTag but just for the square on this simple floor this would in my opinion be a much simpler implementation. Feel free to correct me if im wrong or if something is suboptimal in this solution.