Corgi Engine
v9.0
|
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...
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 |
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.
|
strong |
|
protectedvirtual |
On destroy we disable our object and handle pools
|
protectedvirtual |
Disables the damage area.
|
protectedvirtual |
Enables the damage area.
|
virtual |
Makes the bomb explode, enabling feedbacks and damage area
|
protectedvirtual |
Grabs renderer and pool components
|
protectedvirtual |
On enable we initialize our bomb
|
protectedvirtual |
Check if we should explode on contact
|
protectedvirtual |
On Update we handle our cooldowns and activate the bomb if needed
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
float MoreMountains.CorgiEngine.Bomb.DamageAreaActiveDuration = 1f |
the duration (in seconds) during which the damage area should be active
Collider2D MoreMountains.CorgiEngine.Bomb.DamageAreaCollider |
the collider that defines the damage area
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
float MoreMountains.CorgiEngine.Bomb.ExplodeOnContactDetectionRadius = 1f |
the radius (from this object) within which we'll check for colliders on the ExplosionOnContactLayerMask
MMFeedbacks MoreMountains.CorgiEngine.Bomb.ExplosionFeedback |
the MMFeedbacks to trigger on explosion
LayerMask MoreMountains.CorgiEngine.Bomb.ExplosionOnContactLayerMask |
the layer, or layers, this bomb should explode on contact with
bool MoreMountains.CorgiEngine.Bomb.FlickerSprite = true |
whether or not the sprite attached to this bomb should flicker before exploding
MMPoolableObject MoreMountains.CorgiEngine.Bomb.TargetPoolableObject |
the poolable object component this script will pilot - if left empty, will try to grab this component on itself
Renderer MoreMountains.CorgiEngine.Bomb.TargetRenderer |
the renderer this script will pilot - if left empty, will try to grab this component on itself
float MoreMountains.CorgiEngine.Bomb.TimeBeforeExplosion = 2f |
the duration(in seconds) before the explosion
float MoreMountains.CorgiEngine.Bomb.TimeBeforeFlicker = 1f |
the time (in seconds) before the flicker