There two different types of Resource Buildings. Storage and Generation. Both buildings have two separate forms; one having to do with Gold and the other having to do with Mana.
Gold and Mana generators both do the same thing. They generate resources over a certain period of time. (i.e. 20 mins, 1 hour, 3 days, etc.) The higher level your Mana Mill or Gold Mine is, the faster it will generate resources. If a generator gets attacked or destroyed, any resources in it will be lost. Each generator also has a personal storage which must be emptied into your main storage before you can use those resources. If the generator maxes out its personal storage, it will stop generating resources until it is emptied.
|Gold Mine||Mana Mill|
The storage collects resources and contains them. When a storage is full, all resources gained afterward will not be collected. When a storage is attacked, it will lose a decent amount of resources except for the warehouse which maintains the resources.
|Gold Vault||Mana Vault||Warehouse|