Game Development Reference
In-Depth Information
Now, although the previous code can be nested or transformed into switch statements,
writing it this way gives us other advantages: for one, we control when and under what
conditions certain things will happen, for example:
• Battle music will always be played when the battle begins
• Enemies will chase the player unless they have low health
• At any point that the player is idle, the enemies will have a sneaking advantage
However, with either system, you are going to end up with a lot of code-making decisions
around your game, such as the player, enemies, NPCs, and so on. This will make it hard to
manage, and even worse to try debug; perhaps Unity offers us another way?
Search WWH ::




Custom Search