Gun Controller
Quick ranged-weapon setup for the Combat System. Handles firing, reloading, ammo accounting, network replay of shots, and animator parameter wiring.
Properties
Section titled “Properties”Reference ID
Section titled “Reference ID”string. Used by the combat-system networking to identify this gun. Populated by the inspector.
Particle System
Section titled “Particle System”The Unity Particle System used by the weapon.
Shoot Sounds
Section titled “Shoot Sounds”List of audio clips randomized while shooting.
Reload Sounds
Section titled “Reload Sounds”List of audio clips randomized while reloading.
Empty Shoot Sounds
Section titled “Empty Shoot Sounds”List of audio clips randomized when firing with no ammo.
Magazine Size
Section titled “Magazine Size”Ammo available before a reload is required.
Ammo Capacity
Section titled “Ammo Capacity”Total ammo available to reload into a magazine.
Firing Mode
Section titled “Firing Mode”- Single The weapon must stop firing before it can fire again.
- Half Auto Fires the number of rounds equal to the Firing Rate, then must stop firing before it can fire again.
- Full Auto Fires a continuous stream of rounds per second (Firing Rate) until firing stops or the magazine is empty.
Firing Rate
Section titled “Firing Rate”Rounds per second.
Reload Time
Section titled “Reload Time”Time in seconds a reload takes.
Hit Detection
Section titled “Hit Detection”- Particle Uses the Particle System collision property.
- RayCast Uses an instant raycast.
Hit Mask
Section titled “Hit Mask”Unity Collision Matrix layers the Gun Controller can hit.
Methods
Section titled “Methods”Methods that can be called from Custom Triggers in the CVR Interactable component.
GrantMagazineAmmo
Section titled “GrantMagazineAmmo”Adds ammo to the magazine, up to the Magazine Size.
GrantReserveAmmo
Section titled “GrantReserveAmmo”Adds ammo to the reserve, up to the Ammo Capacity.
Reload
Section titled “Reload”Reloads the magazine.
Fires once per call.
ShootDown
Section titled “ShootDown”Fires until ShootUp is called or the magazine is empty.
Animator Manager
Section titled “Animator Manager”The Gun Controller writes to animator parameters on the same GameObject. Parameter names are case sensitive.
clipAmmoMax
Section titled “clipAmmoMax”Integer. Max magazine size.
clipAmmo
Section titled “clipAmmo”Integer. Current magazine ammo.
reserveAmmoMax
Section titled “reserveAmmoMax”Integer. Max reserve ammo.
reserveAmmo
Section titled “reserveAmmo”Integer. Current reserve ammo.
reloading
Section titled “reloading”Bool. Whether the weapon is reloading.
Bool. Whether the weapon is firing.
dryFire
Section titled “dryFire”Bool. Whether the weapon is firing while clipAmmo is 0.
Related
Section titled “Related”Source
Section titled “Source”CVR-GameFiles/ABI.CCK.Components/GunController.cs