New answers tagged

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: ...


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 ...


0

I am going to give a non-Ruby answer, because I don't know Ruby. I would have lots of classes for this: MenuOneController MenuTwoController MenuOneView MenuTwoView InputNames The controllers navigate the menu. Pressing up and down changes the selected item, pressing enter selects the item. Selecting the item would call code elsewhere to perform the ...


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

There's no one right answer for communication between different domains of any piece of software. In your case, it sounds like you want something like an "event" system. You should give your systems the ability to subscribe to events that other systems "raise" with information about the event. The Observer Pattern is a common pattern when implementing events....



Top 50 recent answers are included