Overview
There are two main objects in the Shooter module:
Weapons: A configuration object that lets you define how a weapon is handled, which prefab is used and the States in which the character will pose when aiming with a particular weapon. Requires an Ammo object linked.
Ammo: A configuration object tied to a weapon that defines how a particular ammunition type works, including the effects of shooting, charging a shot or whether it uses a crosshair, a visual trajectory, ...
IMPORTANT!
Do not duplicate or modify the Weapon and Ammo objects that come as an example. Updating the Shooter module will overwrite your changes. Also, duplicating them will result in keeping multiple-references between the original object and the duplicated one. Always create a new Weapon and Ammo object from scratch.
We’re working on a solution.
Operation
The Shooter module works as a FSM that follows the rules of the diagram below. For example, a Character can not shoot unless it’s armed and aiming.
To transition between different states you’ll need to use the corresponding Action. If a Character tries to shoot when it’s in a state that doesn’t allow to shoot, the system will simply ignore the command.
Here’s a quick example on how to make the Player draw the Sniper Rifle weapon that comes with the Shooter module when the user presses the E key.
(Toggling between pulling a gun and holstering it when the user presses the E key)
Disclaimer: This is just an example. You can decide how to trigger the drawing of the weapon, whether that’s an automatic event as soon as the Player enters a zone, pressing a particular keyboard key or even as soon as the game starts. It’s 100% customizable!