2D Shooter Bullet and Weapon System for Unity  1.4.1
The 2D Shooter Bullet and Weapon System asset provides you with a highly customisable bullet pattern and weapon system, custom weapon configuration editor with inventory manager, along with a bullet pooling manager which is simple to drop into your Unity game or project and start using right away.
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Properties | List of all members
Bullet Class Reference

The main bullet component class for bullets used by the WeaponSystem component. More...

Inheritance diagram for Bullet:

Public Types

enum  BulletOwner { BulletOwner.Player, BulletOwner.Enemy }
 

Public Member Functions

bool GetRicochetChance ()
 Check to determine if a random roll meets the ricochet chance or not. More...
 

Static Public Member Functions

static Vector2 Reflect (Vector2 vector, Vector2 normal)
 This is a basic reflection algorithm (works the same way that Vector3.Reflect() works, but specifically for Vector2. More...
 

Public Attributes

float speed = 1f
 The speed at which the bullet will travel at More...
 
SpriteRenderer bulletSpriteRenderer
 The sprite renderer for the bullet - used to modify bullet color when bullets are instantiated if custom color is selected in Weapon Configuration. More...
 
float directionAngle
 The direction bullet is travelling in radians. More...
 
float directionDegrees
 The direction bullet is travelling in degrees. More...
 
Vector3 newDirection
 Used when calculating reflection / ricochet angles when the bullet impacts a collider. More...
 
float bulletXPosition
 Used to set bullet travel direction based on directionAngle More...
 
float bulletYPosition
 Used to set bullet travel direction based on directionAngle More...
 
float ricochetChancePercent
 The percent chance this bullet has to ricochet (set from the Weapon configuration that fired the bullet) More...
 
bool canRichochet
 Flag to enable / disable ricochet chance More...
 
bool useHitEffects
 Flag to enable / disable bullet impact effects More...
 
string bloodEffectTriggerTag
 Tag of GameObjects that should generate a 'blood impact' effect if this bullet hits them. More...
 

Properties

BulletOwner bulletOwner [get, set]
 Sample enum that allows differentiation of bullets based on whether fired from a 'player' or 'enemy'. More...
 

Detailed Description

The main bullet component class for bullets used by the WeaponSystem component.

Member Enumeration Documentation

enum Bullet.BulletOwner
strong
Enumerator
Player 
Enemy 

Member Function Documentation

bool Bullet.GetRicochetChance ( )

Check to determine if a random roll meets the ricochet chance or not.

Returns
static Vector2 Bullet.Reflect ( Vector2  vector,
Vector2  normal 
)
static

This is a basic reflection algorithm (works the same way that Vector3.Reflect() works, but specifically for Vector2.

Not currently used.

Parameters
vector
normal
Returns

Member Data Documentation

string Bullet.bloodEffectTriggerTag

Tag of GameObjects that should generate a 'blood impact' effect if this bullet hits them.

For example if you have a subject with tag 'Enemy' and this field is set to 'Enemy', when this bullet hits that subject, as the tags match, a bullet impact effect will be generated. (See demo scenes).

SpriteRenderer Bullet.bulletSpriteRenderer

The sprite renderer for the bullet - used to modify bullet color when bullets are instantiated if custom color is selected in Weapon Configuration.

float Bullet.bulletXPosition

Used to set bullet travel direction based on directionAngle

float Bullet.bulletYPosition

Used to set bullet travel direction based on directionAngle

bool Bullet.canRichochet

Flag to enable / disable ricochet chance

float Bullet.directionAngle

The direction bullet is travelling in radians.

float Bullet.directionDegrees

The direction bullet is travelling in degrees.

Vector3 Bullet.newDirection

Used when calculating reflection / ricochet angles when the bullet impacts a collider.

float Bullet.ricochetChancePercent

The percent chance this bullet has to ricochet (set from the Weapon configuration that fired the bullet)

float Bullet.speed = 1f

The speed at which the bullet will travel at

bool Bullet.useHitEffects

Flag to enable / disable bullet impact effects

Property Documentation

BulletOwner Bullet.bulletOwner
getset

Sample enum that allows differentiation of bullets based on whether fired from a 'player' or 'enemy'.


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