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

Add this class to a block and it'll behave like these Super Mario blocks that spawn something when hit from below More...

Inheritance diagram for MoreMountains.CorgiEngine.BonusBlock:
MoreMountains.CorgiEngine.CorgiMonoBehaviour MoreMountains.CorgiEngine.Respawnable

Public Member Functions

virtual void Start ()
 Initialization More...
 
virtual void OnTriggerEnter2D (Collider2D collider)
 Triggered when a CorgiController touches the platform More...
 
virtual void OnTriggerExit2D (Collider2D collider)
 Triggered when a CorgiController exits the platform More...
 
virtual void OnPlayerRespawn (CheckPoint checkpoint, Character player)
 Triggered when the player respawns, resets the block if needed More...
 

Public Attributes

GameObject SpawnedObject
 the object this bonus block should spawn More...
 
int NumberOfAllowedHits =3
 the number of hits the block can take More...
 
bool ResetOnDeath = false
 should this object get reset when the main character dies? More...
 
float SpawnSpeed = 0.2f
 the speed at which the block spawns its content More...
 
Vector3 SpawnDestination
 the offset position for the block's content spawn More...
 
bool AnimateSpawn = true
 if true, should animate the object's spawn More...
 
AnimationCurve MovementCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1f, 1))
 the block's movement Animation Curve More...
 

Protected Member Functions

virtual void Initialization ()
 Initialization More...
 
virtual void Update ()
 This is called every frame. More...
 
virtual void UpdateAnimator ()
 Updates the animator. More...
 

Protected Attributes

Animator _animator
 
bool _hit =false
 
Vector2 _newPosition
 
int _numberOfHitsLeft
 
BoxCollider2D _boxCollider2D
 

Detailed Description

Add this class to a block and it'll behave like these Super Mario blocks that spawn something when hit from below

Member Function Documentation

◆ Initialization()

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

Initialization

◆ OnPlayerRespawn()

virtual void MoreMountains.CorgiEngine.BonusBlock.OnPlayerRespawn ( CheckPoint  checkpoint,
Character  player 
)
virtual

Triggered when the player respawns, resets the block if needed

Parameters
checkpointCheckpoint.
playerPlayer.

Implements MoreMountains.CorgiEngine.Respawnable.

◆ OnTriggerEnter2D()

virtual void MoreMountains.CorgiEngine.BonusBlock.OnTriggerEnter2D ( Collider2D  collider)
virtual

Triggered when a CorgiController touches the platform

Parameters
controllerThe corgi controller that collides with the platform.


◆ OnTriggerExit2D()

virtual void MoreMountains.CorgiEngine.BonusBlock.OnTriggerExit2D ( Collider2D  collider)
virtual

Triggered when a CorgiController exits the platform

Parameters
controllerThe corgi controller that collides with the platform.


◆ Start()

virtual void MoreMountains.CorgiEngine.BonusBlock.Start ( )
virtual

Initialization

◆ Update()

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

This is called every frame.

◆ UpdateAnimator()

virtual void MoreMountains.CorgiEngine.BonusBlock.UpdateAnimator ( )
protectedvirtual

Updates the animator.

Member Data Documentation

◆ _animator

Animator MoreMountains.CorgiEngine.BonusBlock._animator
protected

◆ _boxCollider2D

BoxCollider2D MoreMountains.CorgiEngine.BonusBlock._boxCollider2D
protected

◆ _hit

bool MoreMountains.CorgiEngine.BonusBlock._hit =false
protected

◆ _newPosition

Vector2 MoreMountains.CorgiEngine.BonusBlock._newPosition
protected

◆ _numberOfHitsLeft

int MoreMountains.CorgiEngine.BonusBlock._numberOfHitsLeft
protected

◆ AnimateSpawn

bool MoreMountains.CorgiEngine.BonusBlock.AnimateSpawn = true

if true, should animate the object's spawn

◆ MovementCurve

AnimationCurve MoreMountains.CorgiEngine.BonusBlock.MovementCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1f, 1))

the block's movement Animation Curve

◆ NumberOfAllowedHits

int MoreMountains.CorgiEngine.BonusBlock.NumberOfAllowedHits =3

the number of hits the block can take

◆ ResetOnDeath

bool MoreMountains.CorgiEngine.BonusBlock.ResetOnDeath = false

should this object get reset when the main character dies?

◆ SpawnDestination

Vector3 MoreMountains.CorgiEngine.BonusBlock.SpawnDestination

the offset position for the block's content spawn

◆ SpawnedObject

GameObject MoreMountains.CorgiEngine.BonusBlock.SpawnedObject

the object this bonus block should spawn

◆ SpawnSpeed

float MoreMountains.CorgiEngine.BonusBlock.SpawnSpeed = 0.2f

the speed at which the block spawns its content


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