Weapon Component
The weapon component is a gameplay component that can fire bullets that damage players. If you want a weapon that players can hold, use an Item Component that is set to the Weapon Item Type
Component Settings
Property | Description |
---|---|
Fire Time | The number of seconds between each firing of the weapon. |
Damage Type | How damage is dealt by the weapon. |
Hit Scan | The weapon fires discrete hitscan projectiles. |
Damage | Number of health points to remove from any hit players, per bullet. |
Stun on Hit | Should hitting a player with this weapon stun them. |
Stun Duration (s) | How long the stun should last for, in seconds. |
Shot Count | Number of bullets shot each time the weapon is fired. |
Spread | Number of bullets shot each time the weapon is fired. Can set the min and max horizontal and vertical spread, in degrees. |
None | All bullets come out exactly where the player aimed. |
Random | Bullets come out where the player aimed, plus some random aim offset. |
Max Distance | Maximum distance the bullets can travel in units. |
Spawn Bullet Effect | Should a tracer effect be played to vizualise the bullets. |
Bullet Color | The color of the bullet tracer. |
Spawn Trail Effect | Should a longer lasting secondary tracer effect be used. |
Start Color | Color of the secondary tracer at the end closest to the origin of the shot. |
End Color | Color of the secondary tracer at the end furthest from the origin of the shot. |
Trail Width | The width of the secondary tracer effect. |
Trail Length | The length of the secondary tracer effect before it fades out, from the origin of the shot. |
Beam | The weapon fires a continuous hitscan beam. Shares most properties with Hit Scan weapons. |
Beam Damage Cooldown | Time between each tick of damage being applied to the target. |
Area | The weapon deals damage to all objects within an area. |
Shape | The shape to deal damage within. |
Point | Deal damage to anything that overlaps a point. |
Sphere | Deal damage to anything that overlaps a point. |
Radius | Radius of the damage sphere. |
Fire Sound | The audio clip that plays whenever the weapon fires. Can choose from None, Rifle, Shotgun, Sniper and Custom which allows any audio clip to be used. |
On Hit | A set of Actions to perform whenever the weapon is fired. |
Example Usage
Attack players
The weapon component can be used to challenge players to move through an area without being shot. Combining a weapon component with a moving object via a Simple Animator Component or a Mover Component can make the weapon less predictable.
Combined with Logic Component
The Logic Component can be configured to perform Actions whenever it is shot by a weapon component. This would be used to make a minigame where players must somehow make a weapon component shoot a logic component, maybe by moving the gameobject holding the weapon, or by removing object from between the weapon and logic component.