Hot answers tagged

2

As far as I see it the Shop class (for example) needs dependencies on at least two classes: The current status of the player-character (things like available money, inventory and what quests they are currently on) The current status of the shop the player is visiting (things like shop inventory, prices and available quests) These dependencies must be ...


2

You do already return a reference to the behaviour with the getBehaviour method. You can store the reference in a variable and work with it. Personally, I wouldn't return the components from the other methods. Something like the following if a local variable is enough: YourBehaviour behaviour = actor.getBehaviour(BehaviourType); behaviour.method(); ...



Only top voted, non community-wiki answers of a minimum length are eligible