Tag Info

New answers tagged

0

I use multiple scripts. A power-up is a prefab which is then composed of multiple components which will then apply the changes separately: Resize Changes Speed Changes (can have configurable values) Health Changes (can have configurable values) Visual Effects (reacts to the start and end of the other scripts) This way each script can be configured to ...


2

The Unity3D tutorials actually have a chapter about this: https://unity3d.com/learn/tutorials/modules/intermediate/scripting/coding-practices The author would argue that your switch already gives you a structure to modularize from. You have different effects like Increase Health, Take Damage or Give Item. Those can be astracted in interfaces like ...


1

Single switch script Everything is in one place, better readability. It will be a lot easier to add cases (powerups) when needed. Centralized ressources = good. Multiple scripts Can help when the cases have too much lines. Object-oriented, can be easier to call cases. Looking at your example, the best way to go would be to have one script with a ...



Top 50 recent answers are included