HOW do I efficiently collect data and keep it updated for later reference?
My Programming Background:
I am very new to programming and have chosen C# as my first language. I have been reading about it, watching tutorials, getting time behind the keyboard, and have been moving along pretty well. This has been over the last 6 months or so and I have (for the last month) been working on my first project. I am almost done with creating Pacman as my first attempt at something and it turned out better than expected.
Looking back on my first (almost) completed project I was able to see a lot of places where my code was messy, and where data was either poorly passed or poorly maintained. I found that there are a lot of variables and values that I want to keep track of throughout my project because they are referenced deep in my code or referenced often throughout a class. Some examples are Screen Dimensions, Mouse Bounds, Player Position, etc. These values, so far, are pushed deep into the code through parameters and method calls and stored where they are needed. This seems cumbersome and poorly designed. I know that Delegates can be helpful in keeping values updated in other classes, but I am still confused as to how you get a delegate deep into a class hierarchy without having to reach all the way down and place it there just like placing the value itself to begin with.
I feel like maybe having a static class that doesn't need to be passed or instantiated can help hold the data. If I keep that up to date I can just pull out those values wherever I want. I am not sure that this is practical, or ever possible the way I want to use it. I am really looking for better options or some guidance here. I have done a lot of research and have not found anything that helps me so far.
To make this even simpler, lets just discuss the first step; getting data from all over my project into 1 class without coupling, heavy parameter passing, and so on.
Say i want to make a class that displays all of my values that I am testing out on the screen. It shows mouse bounds (updated in an input class), player position (updated in an actor class), map position (updated in the level system), etc. These values that I want are scattered throughout my code. Some classes I want info from are deeply nested in other classes.