Corgi Engine  v8.8
MoreMountains.CorgiEngine.Bomb Class Reference

A class used to trigger a damage area zone of the selected shape (rectangle or circle) after the defined time before explosion. Typically used for grenades. More...

Inheritance diagram for MoreMountains.CorgiEngine.Bomb:
MoreMountains.CorgiEngine.CorgiMonoBehaviour

Public Types

enum  DamageAreaShapes { DamageAreaShapes.Rectangle, DamageAreaShapes.Circle }
 the possible types of shapes for damage areas More...
 

Public Member Functions

virtual void Explode ()
 Makes the bomb explode, enabling feedbacks and damage area More...
 

Public Attributes

Renderer TargetRenderer
 the renderer this script will pilot - if left empty, will try to grab this component on itself More...
 
MMPoolableObject TargetPoolableObject
 the poolable object component this script will pilot - if left empty, will try to grab this component on itself More...
 
float TimeBeforeExplosion = 2f
 the duration(in seconds) before the explosion More...
 
MMFeedbacks ExplosionFeedback
 the MMFeedbacks to trigger on explosion More...
 
bool ExplodeOnContact = false
 if this is true, the bomb will explode when entering in contact with a collider on a layer that is part of the ExplosionOnContactLayerMask More...
 
float ExplodeOnContactDetectionRadius = 1f
 the radius (from this object) within which we'll check for colliders on the ExplosionOnContactLayerMask More...
 
LayerMask ExplosionOnContactLayerMask
 the layer, or layers, this bomb should explode on contact with More...
 
bool FlickerSprite = true
 whether or not the sprite attached to this bomb should flicker before exploding More...
 
float TimeBeforeFlicker = 1f
 the time (in seconds) before the flicker More...
 
Collider2D DamageAreaCollider
 the collider that defines the damage area More...
 
float DamageAreaActiveDuration = 1f
 the duration (in seconds) during which the damage area should be active More...
 

Protected Member Functions

virtual void OnEnable ()
 On enable we initialize our bomb More...
 
virtual void Initialization ()
 Grabs renderer and pool components More...
 
virtual void Update ()
 On Update we handle our cooldowns and activate the bomb if needed More...
 
virtual void TestExplodeOnContact ()
 Check if we should explode on contact More...
 
virtual void DestroyBomb ()
 On destroy we disable our object and handle pools More...
 
virtual void EnableDamageArea ()
 Enables the damage area. More...
 
virtual void DisableDamageArea ()
 Disables the damage area. More...
 

Protected Attributes

float _timeSinceStart
 
bool _flickering
 
bool _damageAreaActive
 
Color _initialColor
 
Color _flickerColor = new Color32(255, 20, 20, 255)
 
bool _rendererIsNotNull
 
float _timeSinceExplosion
 
bool _exploded
 
RaycastHit2D _hit
 

Detailed Description

A class used to trigger a damage area zone of the selected shape (rectangle or circle) after the defined time before explosion. Typically used for grenades.

Member Enumeration Documentation

◆ DamageAreaShapes

the possible types of shapes for damage areas

Enumerator
Rectangle 
Circle 

Member Function Documentation

◆ DestroyBomb()

virtual void MoreMountains.CorgiEngine.Bomb.DestroyBomb ( )
protectedvirtual

On destroy we disable our object and handle pools

◆ DisableDamageArea()

virtual void MoreMountains.CorgiEngine.Bomb.DisableDamageArea ( )
protectedvirtual

Disables the damage area.

◆ EnableDamageArea()

virtual void MoreMountains.CorgiEngine.Bomb.EnableDamageArea ( )
protectedvirtual

Enables the damage area.

◆ Explode()

virtual void MoreMountains.CorgiEngine.Bomb.Explode ( )
virtual

Makes the bomb explode, enabling feedbacks and damage area

◆ Initialization()

virtual void MoreMountains.CorgiEngine.Bomb.Initialization ( )
protectedvirtual

Grabs renderer and pool components

◆ OnEnable()

virtual void MoreMountains.CorgiEngine.Bomb.OnEnable ( )
protectedvirtual

On enable we initialize our bomb

◆ TestExplodeOnContact()

virtual void MoreMountains.CorgiEngine.Bomb.TestExplodeOnContact ( )
protectedvirtual

Check if we should explode on contact

◆ Update()

virtual void MoreMountains.CorgiEngine.Bomb.Update ( )
protectedvirtual

On Update we handle our cooldowns and activate the bomb if needed

Member Data Documentation

◆ _damageAreaActive

bool MoreMountains.CorgiEngine.Bomb._damageAreaActive
protected

◆ _exploded

bool MoreMountains.CorgiEngine.Bomb._exploded
protected

◆ _flickerColor

Color MoreMountains.CorgiEngine.Bomb._flickerColor = new Color32(255, 20, 20, 255)
protected

◆ _flickering

bool MoreMountains.CorgiEngine.Bomb._flickering
protected

◆ _hit

RaycastHit2D MoreMountains.CorgiEngine.Bomb._hit
protected

◆ _initialColor

Color MoreMountains.CorgiEngine.Bomb._initialColor
protected

◆ _rendererIsNotNull

bool MoreMountains.CorgiEngine.Bomb._rendererIsNotNull
protected

◆ _timeSinceExplosion

float MoreMountains.CorgiEngine.Bomb._timeSinceExplosion
protected

◆ _timeSinceStart

float MoreMountains.CorgiEngine.Bomb._timeSinceStart
protected

◆ DamageAreaActiveDuration

float MoreMountains.CorgiEngine.Bomb.DamageAreaActiveDuration = 1f

the duration (in seconds) during which the damage area should be active

◆ DamageAreaCollider

Collider2D MoreMountains.CorgiEngine.Bomb.DamageAreaCollider

the collider that defines the damage area

◆ ExplodeOnContact

bool MoreMountains.CorgiEngine.Bomb.ExplodeOnContact = false

if this is true, the bomb will explode when entering in contact with a collider on a layer that is part of the ExplosionOnContactLayerMask

◆ ExplodeOnContactDetectionRadius

float MoreMountains.CorgiEngine.Bomb.ExplodeOnContactDetectionRadius = 1f

the radius (from this object) within which we'll check for colliders on the ExplosionOnContactLayerMask

◆ ExplosionFeedback

MMFeedbacks MoreMountains.CorgiEngine.Bomb.ExplosionFeedback

the MMFeedbacks to trigger on explosion

◆ ExplosionOnContactLayerMask

LayerMask MoreMountains.CorgiEngine.Bomb.ExplosionOnContactLayerMask

the layer, or layers, this bomb should explode on contact with

◆ FlickerSprite

bool MoreMountains.CorgiEngine.Bomb.FlickerSprite = true

whether or not the sprite attached to this bomb should flicker before exploding

◆ TargetPoolableObject

MMPoolableObject MoreMountains.CorgiEngine.Bomb.TargetPoolableObject

the poolable object component this script will pilot - if left empty, will try to grab this component on itself

◆ TargetRenderer

Renderer MoreMountains.CorgiEngine.Bomb.TargetRenderer

the renderer this script will pilot - if left empty, will try to grab this component on itself

◆ TimeBeforeExplosion

float MoreMountains.CorgiEngine.Bomb.TimeBeforeExplosion = 2f

the duration(in seconds) before the explosion

◆ TimeBeforeFlicker

float MoreMountains.CorgiEngine.Bomb.TimeBeforeFlicker = 1f

the time (in seconds) before the flicker


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