Unity Game Development — Creating Modular Power-Ups
If one power-up is good, then it stands to reason that more power-ups are even better. In my previous article, I described a way to keep your power-ups from lasting forever. This time around, I would like to dive into creating different kinds of power-ups modularly.
I have a power-up called Triple Shot. It allows the player to shoot three bullets at once. Now, I want to give my player the ability to collect a Speed Boost.
I could create a whole new Script for this new power-up, or I can devise a method from making my current power-up act in different ways depending on certain conditions.
Let’s work on the latter.
OBJECTIVE:
Convert my current power-up script into a modular system for implementing different power-up behaviors.
METHOD:
Currently, my power-up Script calls a method in the Player Script to activate the Triple Shot behavior. What this power-up does, is controlled by the Player Script. The Speed Boost will be no different.