Thanks for your question,
I'm sorry to hear about what you've been going through. It's good that you were able to talk to your friend about it, and often times experiences like you've described seem much more significant to the person who is experiencing them than the people around them. In that way it really is possible that your friend didn't realize that anything is wrong with you, which means you are probably doing a pretty good job of keeping your composure together in most situations. However, I certainly understand your concern, and experiencing these "crashes" of anxiety and depression and that can become a very difficult thing to cope with.
Often times people who experience these types of issues have certain things that trigger these crashes. So perhaps the thoughts that come into your consciousness have similar themes, or that when certain things come up in class or in conversation, you may be more likely to have one of these crashes. If you can start to identify some of these patterns and identify the things that trigger you, that can allow you to spend some time working on these issues on your own. That way you can at least get to a point where you can emotionally prepare yourself to maintain your composure more effectively in these types of situations.
If you've identified these triggers and are still feeling emotionally unbalanced, or if you are having a hard time identifying any patterns that would allow you to get more control over this, that would be the point where it is best to speak with a professional. There are several types of anxiety and depression problems that can cause symptoms like this, and most of them are very treatable through counseling and/or medication. The fact that you are experiencing these problems doesn't mean that you have a permanent or serious condition, and with the right help you should be able to develop some ways to handle your emotions more effectively. I definitely wish you the best with all of this, and if there's anything else I can do to help please let me know.