Skip to content

Scripts.Weapon

Wesley Haws edited this page Jan 29, 2017 · 2 revisions

##Scripts - Weapon

###What does this do?


This controls all of the stats specific to this weapon. Everything from how much damage it will do, visual it produces to how much kick and what time of sounds it will make.

###Who/What is this for?


This is to only be placed on a weapon that is held by a player. Place a weapon exactly how you want a player to hold it in the Unity Inspector then place this script on it and fill out all of the details.

If you're not sure what a variable is used for I have placed Tooltips on each variable. Simply mouse over the variable for a quick description in the Unity Inspector window.

###Setup


Parameter Type Description
Weapon Name string Name of this weapon. This must match in the "WeaponManager" scripts "WeaponSelection" variable.
Anims AnimatorController[] List of animator controllers to send commands to.
Delay Per Shot float How fast the player can fire this weapon.
Damage int How much damage each bullet will do.
Kick Back Amount float How much upward Y movement will be caused to the camera each shot.
Aim Fire Spread float How wide of a circle of possible hit locations will be produced while aiming.
Hip Fire Spread float How wide of a circle of possible hit locations will be produced while not aiming.
Reload Time float How long after a reload is initiated before you can fire this weapon again.
Aim Speed float How fast the camera will move to the aim position.
Bullets Per Shot int How many bullets are produced each time this weapon is fired.
Bullets Left int How many bullets are left in the clip.
Bullets Per Clip int How many bullets will be set in the "Bullets Left" variable after a reload is finished.
Number Of Clips int How many reloads this weapon has left.
Fire Point Transform The location where the raycast will begin.
Max Penetration int How many objects the raycast is allowed to hit before stopping.
Range float How far the raycast will go.
Smoke Trail GameObject Smoke trail gameobject to create after X number of shots.
Show Smoke Every X Shots int How many shots before creating a smoke trail.
Smoke Trail Position Transform Location to generate the smoke trail.
Smoke Trail Life float How many second the smoke trail will live before fading.
Smoke Trail Appear Delay float How many seconds after the X shot before the smoke trail is created.
Smoke Trail Fade Speed float How fast the smoke trail will fade.
Sound Source AudioSource Source of the weapon sounds.
Shot Sounds AudioClip[] List of sounds to randomly choose and play from when a shot is fired.
Shot Volume float (0...1) How loud the shot sound will be.
Shot Pitch float(0...3) Set the pitch of the shot pitch.
Reload Sounds AudioClip[] Random sound to play when a reload is triggered on this weapon.
Reload Volume float(0...1) How load the reload sound will be.
Reload Pitch float(0...3) Set the pitch of the reload sound.
Pickup Ammo Sounds AudioClip[] Random sound to play when you pickup ammo for this weapon.
Muzzle Flash GameObject Gameobject that contains a muzzle flash particle effect.
Muzzle Flash Position Transform Location to generate the muzzle flash.
Muzzle Flash Lifetime float How long the muzzle flash will live before getting removed.
Eject Shell bool Do you want to eject a shell every shot?
Eject Point Transform Location to start the shell ejection
Shell Object GameObject Object to eject every shot.
Shell Life float How long the shell object will live before getting removed.
Pickup Distance float How far away the player can be when pressing the "Action" button to trigger a pickup of this weapon.
Can Pickup bool Is the player allowed to pickup this weapon?
Destroy On Pickup bool Do you want to remove this object when a pickup is triggered?
Clone this wiki locally