Third Person Cover Shooter  1.6
CoverShooter.Gun Class Reference

Default implementation of the BaseGun script. More...

Inheritance diagram for CoverShooter.Gun:
CoverShooter.BaseGun

Public Member Functions

override bool LoadBullet ()
 Increase LoadedBullets, decrease BulletInventory. More...
 
override bool LoadMagazine ()
 Increase the number of loaded bullets, decrease BulletInventory. More...
 
- Public Member Functions inherited from CoverShooter.BaseGun
void ToUse ()
 Command to use the weapon. More...
 
virtual void OnMagazineLoadStart ()
 Notified of a magazine load start by the CharacterMotor. More...
 
virtual void OnBulletLoadStart ()
 Notified of a magazine load start by the CharacterMotor. More...
 
virtual void OnPumpStart ()
 Notified of a magazine load start by the CharacterMotor. More...
 
virtual void OnPumped ()
 Notified of a magazine load start by the CharacterMotor. More...
 
void NotifyRechamber ()
 
void NotifyEject ()
 
void NotifyPumpStart ()
 
void NotifyPump ()
 
void NotifyMagazineLoadStart ()
 
void NotifyBulletLoadStart ()
 
void IgnoreSelf (bool value=true)
 Sets the gun to ignore hitting it's owner. More...
 
void SetFireCondition (int side)
 Sets the gun to not fire if aiming at a friend. More...
 
void CancelFireCondition ()
 Sets the gun to fire in any condition. More...
 
GameObject FindCurrentAimedTarget ()
 Returns a game object the gun is currently aiming at. More...
 
GameObject FindCurrentAimedHealthTarget ()
 Returns a game object with CharacterHealth the gun is currently aiming at. More...
 
RaycastHit Raycast ()
 Finds an object and a hit position a bullet would hit if fired. More...
 
RaycastHit Raycast (Vector3 origin, Vector3 direction, out bool isFriend, bool friendCheck)
 Finds an object and a hit position a bullet would hit if fired. More...
 
void TryFireNow ()
 Sets the gun to try firing during the next update. More...
 
void FireWhenReady ()
 Sets the fire mode on. More...
 
void CancelFire ()
 Sets the fire mode off. More...
 
void Allow (bool value)
 Sets whether the gun is allowed to fire. More...
 
void SetupRaycastThisFrame (Vector3 origin, Vector3 target)
 Sets the position from which bullets are spawned. More...
 
void AddErrorThisFrame (float degrees)
 Sets the aim error in degrees for the next frame. More...
 
void SetBaseErrorMultiplierThisFrame (float multiplier)
 Sets the base error (Error property) multiplier for this frame. More...
 
void UpdateManually ()
 Call the update method manually. More...
 

Public Attributes

int MagazineSize = 10
 Number of bullets stored at max in the weapon. More...
 
int LoadedBullets = 10
 Current number of loaded bullets. More...
 
int BulletInventory = 10000
 Number of bullets that are available to be loaded, not counting the already loaded ones. More...
 
- Public Attributes inherited from CoverShooter.BaseGun
WeaponType Type = WeaponType.Pistol
 Animations and related assets to be used with this weapon. More...
 
string Name = "Gun"
 Name of the gun to be display on the HUD. More...
 
float Zoom = 30
 How many degrees should the camera FOV be reduced when using scope on the gun. More...
 
Sprite Scope
 Sprite that's displayed when zooming in. More...
 
float Rate = 7
 Rate of fire in shots per second. More...
 
int BulletsPerShot = 1
 Bullets fired per single shot. More...
 
bool ConsumeSingleBulletPerShot = true
 If firing multiple bullets per shot, should only a single bullet be removed from the inventory. More...
 
float Distance = 50
 Maximum distance of a bullet hit. More...
 
float Damage = 10
 Damage dealt by a single bullet. More...
 
float Error = 0
 Maximum degrees of error the gun can make when firing. More...
 
bool AutoReload = false
 Should the gun be reloaded automatically when the magazine is empty. More...
 
bool ReloadWithMagazines = true
 Is the gun reloaded with whole magazines or bullet by bullet. More...
 
bool CanInterruptBulletLoad = true
 If reloading bullet by bullet, can the gun be fired during reload. More...
 
bool PumpAfterFinalLoad = false
 After a new magazine or the last bullet is loaded, should the gun be pumped. More...
 
bool PumpAfterBulletLoad = false
 Should the gun be pumped after each bullet load. More...
 
bool PumpAfterFire = false
 Should the gun be pumped after firing a shot. More...
 
bool FireOnMobileAim = true
 Will the character fire by just aiming the mobile controller. More...
 
bool LaserOnlyOnZoom = true
 Should the laser be visible only when zooming. More...
 
bool DebugAim = false
 Should a debug ray be displayed. More...
 
GameObject Aim
 Link to the object that controls the aiming direction. More...
 
GameObject Bullet
 Object to be instantiated as a bullet. More...
 
Transform LeftHandDefault
 Link to the object that controls the position of character's left hand relative to the weapon. More...
 
float DamageResponseWaitTime = 1
 Time in seconds between hits that the target character will respond to with hurt animations. More...
 
bool UseCustomCrosshair
 Should the gun's crosshair be used instead of the one set in the Crosshair component. More...
 
CrosshairSettings CustomCrosshair = CrosshairSettings.Default()
 Custom crosshair settings to override the ones set in the Crosshair component. More...
 
GunRecoilSettings Recoil = GunRecoilSettings.Default()
 Settings that manage gun's recoil behaviour. More...
 
HandOverwrite LeftHandOverwrite
 Links to objects that overwrite the value in LeftHand based on the gameplay situation. More...
 
Laser LaserOverwrite
 Force the pistol to use this laser instead of finding one on its own. More...
 
CharacterMotor Character
 Owning object with a CharacterMotor component. More...
 
Action MagazineLoadStarted
 Event executed at the beginning of a magazine load animation. More...
 
Action FullyLoaded
 Event executed after the gun has been fully loaded. More...
 
Action BulletLoadStarted
 Event executed at the beginning of a bullet load animation. More...
 
Action BulletLoaded
 Event executed after a bullet has been loaded. More...
 
Action PumpStarted
 Event executed at the start of a pump animation. More...
 
Action Pumped
 Event executed at the end of a pump animation. More...
 
Action Fired
 Event executed after a successful fire. More...
 
Action EmptyFire
 Event executed every time there is an attempt to fire with no bullets in the gun. More...
 
Action FireStarted
 Event executed after a series of bullet fires as started. More...
 
Action FireStopped
 Event executed after a series of bullet fires has stopped. More...
 
Action< HitSuccessfulyHit
 Event executed after a bullet hit something. More...
 

Protected Member Functions

override void Consume ()
 Decrease LoadedBullets. More...
 
- Protected Member Functions inherited from CoverShooter.BaseGun
virtual void Start ()
 Get the LineRenderer if there is one. More...
 
virtual void Awake ()
 Finds the renderer. More...
 
virtual void Frame ()
 

Properties

override bool CanLoad [get]
 Can the gun be loaded with more bullets. More...
 
override int LoadedBulletsLeft [get]
 Number of bullets left in the gun. More...
 
override bool IsFullyLoaded [get]
 Is the gun fully loaded with bullets. More...
 
override float LoadPercentage [get]
 Load percentage for the ammo ui. More...
 
- Properties inherited from CoverShooter.BaseGun
Vector3 Origin [get]
 Point of creation for bullets in world space. More...
 
Vector3 Direction [get]
 Direction of bullets when created at the origin. More...
 
bool CanHit [get]
 Whether the gun can be used to perform a melee hit right now. More...
 
bool HasJustFired [get]
 Returns true if the gun fired during the last update. More...
 
bool IsAllowed [get]
 Returns true if the gun is allowed to fire. More...
 
Renderer Renderer [get]
 Renderer attached to the object. More...
 
Vector3 RaycastOrigin [get]
 Origin to cast bullets from. More...
 
Vector3 RaycastTarget [get]
 Target position at which bullets are fired at. More...
 
bool HasRaycastSetup [get]
 Are raycast settings setup manually by some other component. More...
 
abstract bool CanLoad [get]
 Can the gun be loaded with more bullets. More...
 
abstract int LoadedBulletsLeft [get]
 Number of bullets left in the gun. More...
 
abstract bool IsFullyLoaded [get]
 Is the gun fully loaded with bullets. More...
 
abstract float LoadPercentage [get]
 Load percentage for the ammo ui. More...
 
IGunListener [] Listeners [get]
 

Detailed Description

Default implementation of the BaseGun script.

Member Function Documentation

◆ Consume()

override void CoverShooter.Gun.Consume ( )
protectedvirtual

Decrease LoadedBullets.

Implements CoverShooter.BaseGun.

◆ LoadBullet()

override bool CoverShooter.Gun.LoadBullet ( )
virtual

Increase LoadedBullets, decrease BulletInventory.

Execute related events (may include FullyLoaded). </summary

Implements CoverShooter.BaseGun.

◆ LoadMagazine()

override bool CoverShooter.Gun.LoadMagazine ( )
virtual

Increase the number of loaded bullets, decrease BulletInventory.

Execute FullyLoaded event.

Implements CoverShooter.BaseGun.

Member Data Documentation

◆ BulletInventory

int CoverShooter.Gun.BulletInventory = 10000

Number of bullets that are available to be loaded, not counting the already loaded ones.

◆ LoadedBullets

int CoverShooter.Gun.LoadedBullets = 10

Current number of loaded bullets.

◆ MagazineSize

int CoverShooter.Gun.MagazineSize = 10

Number of bullets stored at max in the weapon.

Property Documentation

◆ CanLoad

override bool CoverShooter.Gun.CanLoad
get

Can the gun be loaded with more bullets.

◆ IsFullyLoaded

override bool CoverShooter.Gun.IsFullyLoaded
get

Is the gun fully loaded with bullets.

◆ LoadedBulletsLeft

override int CoverShooter.Gun.LoadedBulletsLeft
get

Number of bullets left in the gun.

◆ LoadPercentage

override float CoverShooter.Gun.LoadPercentage
get

Load percentage for the ammo ui.


The documentation for this class was generated from the following file: