TO THE POINT:
I have 3 classes, EnemyManager(EM), PlayerStatsManager(PSM), and InventoryManager(IM). I do not want any dependencies between these classes, but, EM needs info from PSM and IM to determine Player damage on enemy health. I already have a static variable and function system in PSM so the EM can give the player experience for each enemy killed. I do not like using static Vars and Funcs, but I felt it was the best solution for avoiding dependencies. Now I’m not so sure.
What other ways are their to keep classes independent, while sharing info between them?
MORE DETAILS:
I’ve created a turn based 2d game. The main system is my TIleManager that uses IEnumerators to give control to different classes, aka EnemyManager, ShopManager. The other classes are PlayerStatsManager, and InventoryManager. The TM waits for the player to select a tile to move to than checks to see if any TileEvent classes are controlling that tile and gives that class control, aka a random enemy attack or a city shop.
It wasn’t till I started adding experience from the EM to the PSM that I started having dependency issues. I would rather my EM class did not have references to the PSM or IM, otherwise it can not function without those classes. Adding an event system (OnEnemyKilled) and having other classes be notified when such event occurred is still a type of dependency.
I researched Dependency Injection and googled class Dependencies but could not find a solution. I suppose in a situation where having one class to handle all three functions (EM, PSM, and IM) would be the only real solution, but I wanted to ask anyway and see what programming options are available in this situation.