Module System

What Is The Module System

The module system enables the easy creation of a loadout menu where players can buy and sell upgrades for their vehicles and modify them strategically. A module represents something that can be added to or removed from a vehicle at runtime to give it extra capability or modify something about it. Examples include weapons, shield generators, powerplants and more. The modules system consists of three key components:

  • Module

  • Module Mount

  • Module Manager

To easily access module information on a vehicle, simply access the 'ModuleMounts' list on the Vehicle component.

Modules

A Module component represents a specific module such as a weapon. It is added to the root transform of the object that it represents.

Module Mounts

A Module Mount component represents a specific location on a vehicle where a module can be added. To create a new module mount, create a child game object under the vehicle, position and rotate the transform according to where you want the module to be positioned/oriented, and add a Module Mount component. A module mount is capable of storing multiple modules which can be switched between during gameplay.

Module Managers

A Module Manager is a class that receives events that notify it when a module is added or removed anywhere on the vehicle, enabling it to collect or discard components on the module that it is responsible for managing. Many of the key system components used in the kit, such as Weapons, Health etc, derive from the Module Manager base class. You can create your own module managers by creating a new class that derives from Module Manager, and overriding the event functions 'OnModuleMounted' and 'OnModuleUnmounted'.