Hot answers tagged

6

"Manager" classes can be problematic for various reasons. The two key reasons tend to be: the name is unclear (what actually does "management" entail, and is it always the same for every type of thing being managed?) they tend towards being buckets of functionality that violate the single responsibility principle (that is, that a type should do one thing) ...


5

When you read the blog post you linked to in the comments, then you will see that "being a Manager if by another name" is exactly what it wants you do to. It's general consensus in software development that global variables are evil, and the only alternative is that any data is held by other data. The problem with a class named FoobarManager is that the ...


2

If you handle input directly from the OS's event callback (or similar platform events), you generally only have access to the data the OS gave you for that event. That data usually only pertains to the immediate input action (pressing this key or moving the mouse on that axis, and maybe some information about what modifiers were down). This can make it ...


1

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


1

While I don't know for sure what these two games do, this is how I would do it: Have a Canvas set up with a child GameObject (which can be a prefab) holding all Game Over UI elements. This starts as disabled In the UI GameObject have a script which listens to OnEnable and fills out the relevant info (stats etc) Have a Game Controller that controls the ...


1

If I would implement it in Unity I'd do a dedicated scene with a GUI to show whatever is needed. So in the main scene I would have some script not destroyed on load of a new scene (with DontDestryOnLoad(GameObject go) method) which have all the infos you want to display at the Game Over stage. You could also handle it in a whole scene with variables to ...


1

One approach to a multilayered map would be an array (or 2-dimensional array) of linked lists or vectors holding tile objects. So your tile struct would either hold a pointer to the next tile above it, or you would have "stacks" of tiles of varying heights spread across the grid. Essentially that creates a 3D array. A nice, albeit old article on ...


1

The animations and logic for attacks can be broken down into individual logical units and then sequenced via data files. For example, you might have code like this: AdvanceBehavior(entity, target, speed) FallbackBehavior(entity, target, speed) SoundBehavior(entity, sound_id) AnimateBehavior(entity, anim_id, speed) and then you can have a data file that ...


1

Should I have a base class for the battler which has all the common methods and than inherent each character from that class with its own attack sequences? If you have a lot of battler types, I don't think you would necessarily want them all to be their separate class if they are very similar to each other otherwise. One approach would be to have them all ...


1

Whether you handle input through callbacks or in the game loop have their advantages and disadvantages: Using callbacks: this method make sure to detect any key the user press ,or any other form of input. Being an asynchronous event, any callback is fired at any time, granting real-time input detection. CONS: user input may affect your simulation at any ...



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