Dog whines and barks a lot

Whenever I feel anxious my dog comes to me and whines for me to pet and love her but if I'm having a panick attack she barks at my parents non stop I don't understand why she does that