I'm trying to implement the DI framework in my project but I'm starting to get some Gotcha issues.
1) For example on trigger enter my character should take damage.
How do I get the Idamagable interface out of my container on trigger enter?
2) If a script requires a certain audioclip can I just manually register the audioClip itself and does it get injected if it has the same name for example or do I have to write a specific data wrapper class that contains only the audioClip?
3) Related to the previous question, some of my classes require the transform of the object it "belongs" to.
How do I inject that?
Right now I added a empty monobehaviour to a character prefab for example, I register that to the DI container and I inject that as a substitute to get the "gameobject".
4) The same goes for coroutines. I inject the monobehaviour component and run coroutines on that component.
Is this the intended way of handling this?
I'm trying to implement the DI framework in my project but I'm starting to get some Gotcha issues.
1) For example on trigger enter my character should take damage. How do I get the Idamagable interface out of my container on trigger enter?
2) If a script requires a certain audioclip can I just manually register the audioClip itself and does it get injected if it has the same name for example or do I have to write a specific data wrapper class that contains only the audioClip?
3) Related to the previous question, some of my classes require the transform of the object it "belongs" to. How do I inject that? Right now I added a empty monobehaviour to a character prefab for example, I register that to the DI container and I inject that as a substitute to get the "gameobject".
4) The same goes for coroutines. I inject the monobehaviour component and run coroutines on that component. Is this the intended way of handling this?