Skip to content

Scripts.GunManager

Wesley Haws edited this page Jan 30, 2017 · 1 revision

##Scripts - GunManager

###What does this do?


Allows an NPC object to send damage to the player, apply visuals, play gunshot sounds, etc.

###Who/What is this for?


NPC Gameobject that has a weapon. (This is not be be confused with the "Weapon" script which is only designed for the player).

###Setup


Parameter Type Description
Muzzle_flash GameObject A Gameobject that contains a muzzle flash particle effect. This will be created every shot.
Destroy Muzzle Flash float The amount of time the muzzle flash will remain in play until removed.
Gunshots AudioClip[] Random sound to play when a shot is fired.
Override Audio Source AudioSource The audio source to play sounds from. If one isn't supplied it will find the first audio source component attached at this same level.
Override Firing Point Transform Location to start the raycast. If one isn't supplied it simply use this objects transform position.
Accuracy float The lower the number the higher chance each raycast is possible to hit the target.
Damage int How much damage to apply to the targets that have a "Health" script.
Raycast Distance float How far the raycast can travel
Hit Dictionary Custom[] Supply only a material name or a tag not both. Material Name = MeshRenderer materials name that it hits. Tag = Tag of the hit gameobject. Visual = Particle Effect to play when this object is hit. Visual Destroy Delay = How long the particle effect lasts. Decal = Gameobject to display in the orientation of the hit object. Decal Destroy Delay = How long the gameobject(Decal) will last before being removed. Sound To Play = Random sound to play when hitting this object. Volume = How loud to play the sound.
Debug Ray bool Show the raycast line?
Debug Ray Hit bool Display the objects name that was hit by the ray in the console window.
Clone this wiki locally