Bullet Dynamics v1.0.0
Loading...
Searching...
No Matches
BulletDynamics.Damage.BulletDamageHandler Class Reference

Component that subscribes to BulletEnvironment events and listens to Bullet.OnCollision event. It will apply the damage to the IDamageableByBullet found on the DynamicSurface that the Bullet collided with. More...

Classes

class  BulletDamageConnection
 Connects Core.BulletData with the damage it will cause. More...
 

Protected Member Functions

virtual void Start ()
 
virtual void OnDestroy ()
 
virtual void OnBulletCollision (DynamicSurface surface, BulletHitInfo hitInfo, Bullet bullet)
 
Handler for the Bullet.OnCollision event.
It will apply damage to the IDamageableByBullet component found on the surface game object or any parent object (using GameObject.GetComponentInParent(System.Type)).
If the surface or the IDamageableByBullet is null, damage won't be applied.
 
virtual float GetApplicableDamage (Bullet bullet)
 Returns the damage that the Bullet will cause.
 

Protected Attributes

List< BulletDamageConnection_damageConnections = default
 
float _defaultDamage = 100
 
bool _reduceDamageBasedOnBulletVelocity = true
 

Detailed Description

Component that subscribes to BulletEnvironment events and listens to Bullet.OnCollision event. It will apply the damage to the IDamageableByBullet found on the DynamicSurface that the Bullet collided with.

Definition at line 12 of file BulletDamageHandler.cs.

Member Function Documentation

◆ GetApplicableDamage()

virtual float BulletDynamics.Damage.BulletDamageHandler.GetApplicableDamage ( Bullet bullet)
protectedvirtual

Returns the damage that the Bullet will cause.

Returns
Damage that can be applied to the IDamageableByBullets.

Definition at line 85 of file BulletDamageHandler.cs.

◆ OnBulletCollision()

virtual void BulletDynamics.Damage.BulletDamageHandler.OnBulletCollision ( DynamicSurface surface,
BulletHitInfo hitInfo,
Bullet bullet )
protectedvirtual


Handler for the Bullet.OnCollision event.
It will apply damage to the IDamageableByBullet component found on the surface game object or any parent object (using GameObject.GetComponentInParent(System.Type)).
If the surface or the IDamageableByBullet is null, damage won't be applied.

Parameters
surfaceDynamicSurface that the Bullet hit.
hitInfoInformation about the hit.
bulletBullet that raised this event.

Definition at line 63 of file BulletDamageHandler.cs.

◆ OnDestroy()

virtual void BulletDynamics.Damage.BulletDamageHandler.OnDestroy ( )
protectedvirtual

Definition at line 46 of file BulletDamageHandler.cs.

◆ Start()

virtual void BulletDynamics.Damage.BulletDamageHandler.Start ( )
protectedvirtual

Definition at line 37 of file BulletDamageHandler.cs.

Member Data Documentation

◆ _damageConnections

List<BulletDamageConnection> BulletDynamics.Damage.BulletDamageHandler._damageConnections = default
protected

Definition at line 31 of file BulletDamageHandler.cs.

◆ _defaultDamage

float BulletDynamics.Damage.BulletDamageHandler._defaultDamage = 100
protected

Definition at line 33 of file BulletDamageHandler.cs.

◆ _reduceDamageBasedOnBulletVelocity

bool BulletDynamics.Damage.BulletDamageHandler._reduceDamageBasedOnBulletVelocity = true
protected

Definition at line 35 of file BulletDamageHandler.cs.