Hot answers tagged

3

The Unity way Automate the export and import of package files. This can be done using the command line options for Unity and a batch script file, something like the following script (line breaks added for readability): Unity -projectPath "C:\Code\AI\Base\BaseWorld" -exportPackage "Assets\Scripts" "C:\Code\AI\BaseWorldPackage.unitypackage" -quit ...


2

The idea is simple. You need to have a way to define an object on the screen. It should contain the information for the rendering (like textures, effects, etc.) and for the game logic (velocity, acceleration, etc.). The main game logic shouldn't touch the rendering parts and vice-versa. There are variables, which needs to be used by both systems (like the ...


2

This depends on the language. Since you didn't mention language, I am for the moment going to assume either C++ or C# or D or Rust or some similar low-level language (not Java!), because game development. There are zero advantages to keeping x and y as members of Player rather than abstracting out to a Point/Location type. There are many many advantages to ...


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(); ...


1

EDIT: @Bálint made a great point about my answer. This works best for 2D rendering frameworks (SDL, XNA, etc) and less so with working directly with things like DirectX/OpenGL, which require a much closer coupling of the WHAT, WHERE, and HOW that I list below. Here is the paradigm I follow with how I organize my classes and what responsibilities each has: ...



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