Skip to content

Player.Weapon

Wesley Haws edited this page Apr 22, 2017 · 1 revision

Weapon


This is the most complicated part of the system. This allows you to fully customize a weapon of your liking. It can have as much or as little flashy things as you want on it.

Parameter Description
FireMode Semi or Auto. Auto allows you to hold the mouse button down and based on the "waitBetweenShots" parameter it will auto fire at that rate. Semi requires you to press the mouse button down to fire the weapon.
ZoomType Iron sights to aim or a scope to aim.
WeaponType This must match your weaponItem (if you have one). This is a way to keep your weapon unique among others so the weaponSystem doesn't get confused.
weaponSoundSource Where the weapon sounds will play from.
equip List of possible equip sounds to randomly choose and play from when the weapon is equipped.
unequip List of possible sounds to randomly choose and play from when the weapon is unequipped.
fire list of possible sounds to randomly choose and play from when the weapon is fired.
reload list of possible sounds to randomly choose and play from when the weapon is reloaded.
empty list of possible sounds to randomly choose and play from when the weapon is fired but no bullets are left in the clip.
aimInaccuracy Inaccuracy to be applied when aiming. Note: Inaccuracy is automatically calculated when firing from the hip based on your gui aimer elements placement on the screen.
waitBetweenShots How long you have to wait in btween firing a shot.
aimSpeed How fast you can aim with this weapon.
recoilAmount How much recoil happens when you fire this weapon.
damagerPerShot How much damage each bullet hit will apply. Note: This is each bullet so for shotguns this might need to be a lower amount.
reloadTime How long you have to wait when you clicked to reload before you can fire another shot.
bullet_left How many bullets will this gun start out with in its clip.
clips_left How many clips will this weapon start out with.
bulletsPerClip How many bullets are held in each clip.
bulletsPerShot How many bullet projectiles are fired each shot. Note: This will only decrease the "bullets_left" parameter by one each shot but will fire X number of bullet projectiles.
hideDuringZoom List of gameobjects to hide while aiming. This is important when creating a sniper. For example you will want to hide the hands and the gun and only display the sniper scope.
aimPosition Adjust this to a position that you want to aim from. Note: Best to do this in the editor first, copy the values, and place then here.
startPosition Location that the hip fire position will be.
recoilSpeed How fast the weapon will recoil and recover.
sniperAim Texture to display that will cover the screen. This should be a sniper scope of some kind.
zoomSpeed How fast you will zoom in while aiming.
aimZoom How far you will zoom in while aiming.
ZoomEffect Should be the main camera that is applied here. Applies a zooming effect to when when aiming your weapon.
RecoilEffect Should be the weapon camera that is applied here. Applied a recoil effect when firing your weapon.
muzzleFlash A burst particle system to play. Note: This particle system needs to be in burst effect. Meaning it will only last one frame when stop.
muzzleLight A muzzle light effect to play when you fire the weapon.
fireTracerBetweenShots randomly choose between x and y amount of shots to fire a tracer particle effect. Must be in burst mode meaning that it should only last 1 frame and be done.
tracer particle effect to simulate a tracer (can be achieving using unity free assets that come with unity 5)
ejectShell a rigidbody gameoject that will be thrown from "ejectPoint" position when a shot is fired.
ejectPoint Location where the ejectShell will be instantiated.
ejectDirection Throw the ejectShell left or right from the weapon.
Clone this wiki locally