platformer
Public Member Functions | Public Attributes | List of all members
UnityPlatformer.Projectile Class Reference

A projectile is an Object that move and collide with the environment. More...

Inheritance diagram for UnityPlatformer.Projectile:
UnityPlatformer.IUpdateEntity

Public Member Functions

virtual Projectile Fire (Vector3 position)
 Clone the projectile, activate, add it to UpdateManager and return :) More...
 
virtual void PlatformerUpdate (float delta)
 Move projectile accordingly More...
 
virtual void LatePlatformerUpdate (float delta)
 Do nothing use PlatformerUpdate instead More...
 
virtual void OnTriggerEnter2D (Collider2D o)
 When collide with something, check the mask, then check if it's damageable, and Destroy More...
 
virtual void Destroy ()
 Destroy Projectile waiting destroyDelay if needed More...
 
void DestroyNow ()
 Real destroy method More...
 

Public Attributes

LayerMask collisionMask
 Layers wich destroy the projectile: StaticGeometry + HitBox + Projectiles More...
 
Vector2 velocity
 Initial velocity More...
 
Vector2 gravity = Vector2.zero
 Gravity, Projectiles ignore global gravity, usually everyone want straight projectiles More...
 
float destroyDelay
 Delay after impact before destroying the projectile More...
 
Action onImpact
 Callback when impact something More...
 
Action onDestroy
 Callback when is destroyed More...
 

Detailed Description

A projectile is an Object that move and collide with the environment.

If a projectile collide with a HitBox then deal damage
If a projectile collide witht the world is destroyed

Member Function Documentation

◆ Destroy()

virtual void UnityPlatformer.Projectile.Destroy ( )
inlinevirtual

Destroy Projectile waiting destroyDelay if needed

◆ DestroyNow()

void UnityPlatformer.Projectile.DestroyNow ( )
inline

Real destroy method

◆ Fire()

virtual Projectile UnityPlatformer.Projectile.Fire ( Vector3  position)
inlinevirtual

Clone the projectile, activate, add it to UpdateManager and return :)

◆ LatePlatformerUpdate()

virtual void UnityPlatformer.Projectile.LatePlatformerUpdate ( float  delta)
inlinevirtual

Do nothing use PlatformerUpdate instead

Implements UnityPlatformer.IUpdateEntity.

◆ OnTriggerEnter2D()

virtual void UnityPlatformer.Projectile.OnTriggerEnter2D ( Collider2D  o)
inlinevirtual

When collide with something, check the mask, then check if it's damageable, and Destroy

◆ PlatformerUpdate()

virtual void UnityPlatformer.Projectile.PlatformerUpdate ( float  delta)
inlinevirtual

Move projectile accordingly

Implements UnityPlatformer.IUpdateEntity.

Member Data Documentation

◆ collisionMask

LayerMask UnityPlatformer.Projectile.collisionMask

Layers wich destroy the projectile: StaticGeometry + HitBox + Projectiles

◆ destroyDelay

float UnityPlatformer.Projectile.destroyDelay

Delay after impact before destroying the projectile

◆ gravity

Vector2 UnityPlatformer.Projectile.gravity = Vector2.zero

Gravity, Projectiles ignore global gravity, usually everyone want straight projectiles

◆ onDestroy

Action UnityPlatformer.Projectile.onDestroy

Callback when is destroyed

◆ onImpact

Action UnityPlatformer.Projectile.onImpact

Callback when impact something

◆ velocity

Vector2 UnityPlatformer.Projectile.velocity

Initial velocity


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