Platformer Pro  2.3.2
A platform game kit for Unity.
PlatformerPro.Hazard Class Reference

A hazard causes damage to a player. The default hazard is a trigger and requires the player to have a collider. More...

Inheritance diagram for PlatformerPro.Hazard:
PlatformerPro.EnemyHazard PlatformerPro.EnemyHitBox

Public Attributes

int damageAmount
 Amount of damage dealt by this object. More...
 
DamageType damageType
 What type of damage does this hazard cause? More...
 
bool oneShot
 Should the damage be caused once, or should it be sent every frame. More...
 
bool damageCharacters = true
 Does this hazard cause damage to characters? More...
 
bool damageEnemies
 Does this hazard also cause damage to enemies? More...
 

Protected Member Functions

virtual void Init ()
 Initialise this instance. More...
 
virtual void DoHit (Collider2D other)
 Do the actual hit. More...
 

Protected Attributes

bool hasFired
 Has the damage happened (for one shot types). More...
 
DamageInfo damageInfo
 Cache the damage info to avoid allocation. More...
 

Detailed Description

A hazard causes damage to a player. The default hazard is a trigger and requires the player to have a collider.

Member Function Documentation

◆ DoHit()

virtual void PlatformerPro.Hazard.DoHit ( Collider2D  other)
protectedvirtual

Do the actual hit.

Parameters
otherOther.

Reimplemented in PlatformerPro.EnemyHitBox, and PlatformerPro.EnemyHazard.

◆ Init()

virtual void PlatformerPro.Hazard.Init ( )
protectedvirtual

Initialise this instance.

Reimplemented in PlatformerPro.EnemyHazard.

Member Data Documentation

◆ damageAmount

int PlatformerPro.Hazard.damageAmount

Amount of damage dealt by this object.

◆ damageCharacters

bool PlatformerPro.Hazard.damageCharacters = true

Does this hazard cause damage to characters?

◆ damageEnemies

bool PlatformerPro.Hazard.damageEnemies

Does this hazard also cause damage to enemies?

◆ damageInfo

DamageInfo PlatformerPro.Hazard.damageInfo
protected

Cache the damage info to avoid allocation.

◆ damageType

DamageType PlatformerPro.Hazard.damageType

What type of damage does this hazard cause?

◆ hasFired

bool PlatformerPro.Hazard.hasFired
protected

Has the damage happened (for one shot types).

◆ oneShot

bool PlatformerPro.Hazard.oneShot

Should the damage be caused once, or should it be sent every frame.


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