Links
Comment on page

Game Modules Actor

v4.0
Game Modules 4 introduces the GameModulesActor class, along with the GameModulesInventoryActor. These classes are set up to automate the Game Module systems.
You can inherit from these classes! The Party Based RPG demo game DemoActor inhertis from GameModulesInventoryActor.
If you're using the Inventory system, inherit from GameModulesInventoryActor. Otherwise, inherit from GameModulesActor.

Start Actions

Add the StartActions class to your object, and drag the object itself into the list. Any IHaveStartActions class (Monobehaviour or otherwise) can be added to this list. When the object is created, or when the gameplay starts, the StartActions() method will be automatically called by the StartActions class on each of the objects in the list.
The component has recently been updated, after the video below was made. It now will automatically cache the IHaveStartActions classes which it can find on the object it is attached to, whenever you view it in the Inspector.

Starting Stats

Game Modules 4 comes with a new StartingStats component. Add this to the object which holds your GameModulesActor, or any other field that implements IHaveStats.
Choose Stats you wish to add when the game starts. If the Stat already exists, nothing will happen (to avoid overwriting existing data).
This is a convenient way to specify the starting values for an actor.
The component will automatically cache the fields at edit time, minimizing the resources required at runtime. Simply adding the component or viewing it in the Inspector will trigger the script to find IHaveStats classes.

Important Methods

Most of the Game Module actions are automatic, and already set up if you inherit from GameModulesActor. However, you should still run these to methods from your Actor class or monobehaviour.
In the Party Based RPG demo game, the DemoActor class inherits from GameModulesInventoryActor, but is not a monobehaviour.
Instead, the GameData class, which has a List<DemoActor> which holds the four players, is a monobehaviour, and calls the Tick() and StartActions() methods.

Tick() and LateTick()

In 4.0.3, this has been automated. The GameModulesActor will automatically register itself with the ModulesHelper if it has Quests, or when a Quest is added. ModulesHelper will now call Tick(), so you no longer have to remember this!
There are many helpful methods on these classes. Please read the scripts to familiarize yourself with them. The scripts are well documented.