New answers tagged

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


0

I did create a few prototypes but nothing too big and the way I used to handle multiple spaces was simply create a game object which contains, world, player etc and than I'd setup some properties that are required by some other spaces for example health, in the game object Whenever called it will get the player's health. that way I could send it to the HUD ...


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


0

I implemented https://sourceforge.net/projects/satsumagraph/?source=navbar and it worked great. Very simple to use. Added undirected adjacency to a customgraph then used a subgraph to call a stronglyconnected query that returns a list of strongly connected nodes.


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


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

Should I create a component to wrap each mesh, texture, animation class and wrap the rendering loop as a system in my framework? No, you should definitely not create a component (in the "entity-component" sense) for each of meshes, textures, animations, et cetera. What good is a texture component attached to an entity without any of the other rendering ...


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


0

I'm going to try and write some example code using delegates since I think they might do what you want. Code is mostly taken from the delegate section of MSDN using UnityEngine; using System.Collections; namespace MyNamespace { public class ShowPoints : MonoBehaviour { public void showPoitsn() { Debug.Log("ShowingPoints"...



Top 50 recent answers are included