Regularity of Optimal Solutions and the Optimal Cost for Hybrid Dynamical Systems via Reachability Analysis