Corgi Engine  v9.1
MoreMountains.CorgiEngine.FallingPlatform Class Reference

Add this script to a platform and it'll fall down when walked upon by a playable character Add an AutoRespawn component to your platform and it'll get reset when your character dies More...

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

Public Member Functions

virtual void OnTriggerStay2D (Collider2D collider)
 Triggered when a CorgiController touches the platform More...
 

Public Attributes

float TimeBeforeFall = 2f
 the time (in seconds) before the fall of the platform More...
 
float FallSpeed = 2f
 the speed at which the platforms falls More...
 
float Tolerance = 0.1f
 the tolerance to apply when comparing the relative positions of the falling platform and More...
 
bool RequiresCharacterAbove = true
 if this is true, the platform will only fall if the colliding character is above the platform More...
 
bool Shaking => _shaking
 whether this platform is currently shaking or not More...
 

Protected Member Functions

virtual void Start ()
 Initialization More...
 
virtual void Initialization ()
 Grabs components and saves initial position and timer More...
 
virtual void FixedUpdate ()
 This is called every frame. More...
 
virtual void DisableFallingPlatform ()
 Disables the falling platform. We're not destroying it, so we can revive it on respawn More...
 
virtual void UpdateAnimator ()
 Updates the block's animator. More...
 
virtual void OnTriggerExit2D (Collider2D collider)
 Triggered when a CorgiController exits the platform More...
 
virtual void OnRevive ()
 
virtual void OnEnable ()
 When the player respawns, we reinstate this agent. More...
 
virtual void OnDisable ()
 

Protected Attributes

Animator _animator
 
bool _shaking = false
 
Vector2 _newPosition
 
Bounds _bounds
 
Collider2D _collider2D
 
Vector3 _initialPosition
 
float _timer
 
float _platformTopY
 
AutoRespawn _autoRespawn
 

Detailed Description

Add this script to a platform and it'll fall down when walked upon by a playable character Add an AutoRespawn component to your platform and it'll get reset when your character dies

Member Function Documentation

◆ DisableFallingPlatform()

virtual void MoreMountains.CorgiEngine.FallingPlatform.DisableFallingPlatform ( )
protectedvirtual

Disables the falling platform. We're not destroying it, so we can revive it on respawn

◆ FixedUpdate()

virtual void MoreMountains.CorgiEngine.FallingPlatform.FixedUpdate ( )
protectedvirtual

This is called every frame.

◆ Initialization()

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

Grabs components and saves initial position and timer

◆ OnDisable()

virtual void MoreMountains.CorgiEngine.FallingPlatform.OnDisable ( )
protectedvirtual

◆ OnEnable()

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

When the player respawns, we reinstate this agent.

Parameters
checkpointCheckpoint.
playerPlayer.

◆ OnRevive()

virtual void MoreMountains.CorgiEngine.FallingPlatform.OnRevive ( )
protectedvirtual

◆ OnTriggerExit2D()

virtual void MoreMountains.CorgiEngine.FallingPlatform.OnTriggerExit2D ( Collider2D  collider)
protectedvirtual

Triggered when a CorgiController exits the platform

Parameters
controllerThe corgi controller that collides with the platform.

◆ OnTriggerStay2D()

virtual void MoreMountains.CorgiEngine.FallingPlatform.OnTriggerStay2D ( Collider2D  collider)
virtual

Triggered when a CorgiController touches the platform

Parameters
controllerThe corgi controller that collides with the platform.


◆ Start()

virtual void MoreMountains.CorgiEngine.FallingPlatform.Start ( )
protectedvirtual

Initialization

◆ UpdateAnimator()

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

Updates the block's animator.

Member Data Documentation

◆ _animator

Animator MoreMountains.CorgiEngine.FallingPlatform._animator
protected

◆ _autoRespawn

AutoRespawn MoreMountains.CorgiEngine.FallingPlatform._autoRespawn
protected

◆ _bounds

Bounds MoreMountains.CorgiEngine.FallingPlatform._bounds
protected

◆ _collider2D

Collider2D MoreMountains.CorgiEngine.FallingPlatform._collider2D
protected

◆ _initialPosition

Vector3 MoreMountains.CorgiEngine.FallingPlatform._initialPosition
protected

◆ _newPosition

Vector2 MoreMountains.CorgiEngine.FallingPlatform._newPosition
protected

◆ _platformTopY

float MoreMountains.CorgiEngine.FallingPlatform._platformTopY
protected

◆ _shaking

bool MoreMountains.CorgiEngine.FallingPlatform._shaking = false
protected

◆ _timer

float MoreMountains.CorgiEngine.FallingPlatform._timer
protected

◆ FallSpeed

float MoreMountains.CorgiEngine.FallingPlatform.FallSpeed = 2f

the speed at which the platforms falls

◆ RequiresCharacterAbove

bool MoreMountains.CorgiEngine.FallingPlatform.RequiresCharacterAbove = true

if this is true, the platform will only fall if the colliding character is above the platform

◆ Shaking

bool MoreMountains.CorgiEngine.FallingPlatform.Shaking => _shaking

whether this platform is currently shaking or not

◆ TimeBeforeFall

float MoreMountains.CorgiEngine.FallingPlatform.TimeBeforeFall = 2f

the time (in seconds) before the fall of the platform

◆ Tolerance

float MoreMountains.CorgiEngine.FallingPlatform.Tolerance = 0.1f

the tolerance to apply when comparing the relative positions of the falling platform and


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