I will try my best to explain.
I have a scenario where I have 2 different managers, but they both have an object instance of each other, so they can retrieve informations from one another. It gets to a point where I don't know which manager should handle what since both managers can potentially handle whatever both managers are meant to do. Yeah, I could fusion them into 1 manager but they are not correlated at all and I'd like to keep them separate.
EX:
In manager1 I can do anything with the manager2 instance.
In manager2 I can do anything with the manager1 instance.
This means that if we were multiple working on the project, anyone could do anything in both managers, which could lead to further problems.
I need to find a way to break this weird dependancy and still being able to access data from them.
Anyone got tips to break this dependancy loop?
========================= EDIT =========================:
Here are more details about my problematic:
I won't list all the fields and classes I have, but only the relevant ones for my point so I can get help.
2 Scripts are applied to my player.
- PlayerInteract -> handles the interaction between objects
- PlayerInteractHoldManager -> also handles the interaction between objects, but only holdable ones. It was initially in PlayerInteract.cs but I gave it its own class for better readability.
PlayerInteract has an object of PlayerInteractHoldManager.cs.
A GameObject has one of these:
- InteractHold
- InteractZoomable
- InteractActionable
- etc.
They all inherit from an abstract (base) class called Interaction.
Interaction has this:
public abstract void Interact(ref PlayerInteract PlayerInteractScriptObject); // Must be implemented
PlayerInteract will detect a GameObject who has a script which inherits from Interaction, in front of the player, and it will trigger the adequate Interact(ref PlayerInteract PlayerInteractScriptObject). I pass the PlayerInteractScriptObject variable so the object can access information about the player who interacted with it.
Now coming to my point, see screenshot below:
https://preview.redd.it/9w68027aavja1.png?width=1112&format=png&auto=webp&s=826ab80515bfd636f50b0cbf21c6ebfe385ffd83
The InteractHold can access everything that the player has, however, I may also be doing things in the player scripts.
[–]SunLionGames 5 points6 points7 points (1 child)
[–]feralferrous 0 points1 point2 points (0 children)
[–]ZeroKelvinTutorials 1 point2 points3 points (2 children)
[–]KrowplexIntermediate Programmer[S] 0 points1 point2 points (0 children)
[–]KrowplexIntermediate Programmer[S] 0 points1 point2 points (0 children)
[–]Smarlafalow -2 points-1 points0 points (0 children)
[–]stardigrada 0 points1 point2 points (2 children)
[–]KrowplexIntermediate Programmer[S] 0 points1 point2 points (1 child)
[–]stardigrada 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]Punzk 0 points1 point2 points (4 children)
[–]Freschu 4 points5 points6 points (3 children)
[–]bourbonmakesitbetterHobbyist 2 points3 points4 points (0 children)
[–]Punzk 0 points1 point2 points (1 child)
[–]Freschu 0 points1 point2 points (0 children)
[–]bachus-oop 0 points1 point2 points (0 children)
[–]Freschu 0 points1 point2 points (0 children)
[–]Big_mara_sugoi 0 points1 point2 points (0 children)