TopDown Engine v4.5
Loading...
Searching...
No Matches
MoreMountains.TopDownEngine.FallingPlatform2D 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.TopDownEngine.FallingPlatform2D:
MoreMountains.TopDownEngine.TopDownMonoBehaviour MoreMountains.Tools.MMMonoBehaviour

Public Types

enum  FallingPlatformStates { Idle , Shaking , Falling , ColliderOff }
 the possible states for the falling platform More...

Public Member Functions

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

Public Attributes

FallingPlatformStates State
 the current state of the falling platform
bool InevitableFall = false
 if this is true, the platform will fall inevitably once touched
float TimeBeforeFall = 2f
 the time (in seconds) before the fall of the platform
float DelayBetweenFallAndColliderOff = 0.5f
 the time (in seconds) before the collider turns itself off once the fall has started

Protected Member Functions

virtual void Start ()
 Initialization.
virtual void Initialization ()
 Grabs components and saves initial position and timer.
virtual void FixedUpdate ()
 This is called every frame.
virtual void DisableFallingPlatform ()
 Disables the falling platform. We're not destroying it, so we can revive it on respawn.
virtual void UpdateAnimator ()
 Updates the block's animator.
virtual void OnTriggerExit2D (Collider2D collider)
 Triggered when a TopDownController exits the platform.
virtual void OnRevive ()
 On Revive, we restore this platform's state.

Protected Attributes

Animator _animator
Vector2 _newPosition
Bounds _bounds
Collider2D _collider
Vector3 _initialPosition
float _timeLeftBeforeFall
float _fallStartedAt
bool _contact = false

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 Enumeration Documentation

◆ FallingPlatformStates

the possible states for the falling platform

Enumerator
Idle 
Shaking 
Falling 
ColliderOff 

Member Function Documentation

◆ DisableFallingPlatform()

virtual void MoreMountains.TopDownEngine.FallingPlatform2D.DisableFallingPlatform ( )
protectedvirtual

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

◆ FixedUpdate()

virtual void MoreMountains.TopDownEngine.FallingPlatform2D.FixedUpdate ( )
protectedvirtual

This is called every frame.

◆ Initialization()

virtual void MoreMountains.TopDownEngine.FallingPlatform2D.Initialization ( )
protectedvirtual

Grabs components and saves initial position and timer.

◆ OnRevive()

virtual void MoreMountains.TopDownEngine.FallingPlatform2D.OnRevive ( )
protectedvirtual

On Revive, we restore this platform's state.

◆ OnTriggerExit2D()

virtual void MoreMountains.TopDownEngine.FallingPlatform2D.OnTriggerExit2D ( Collider2D collider)
protectedvirtual

Triggered when a TopDownController exits the platform.

Parameters
controllerThe TopDown controller that collides with the platform.

◆ OnTriggerStay2D()

virtual void MoreMountains.TopDownEngine.FallingPlatform2D.OnTriggerStay2D ( Collider2D collider)
virtual

Triggered when a TopDownController touches the platform.

Parameters
controllerThe TopDown controller that collides with the platform.

◆ Start()

virtual void MoreMountains.TopDownEngine.FallingPlatform2D.Start ( )
protectedvirtual

Initialization.

◆ UpdateAnimator()

virtual void MoreMountains.TopDownEngine.FallingPlatform2D.UpdateAnimator ( )
protectedvirtual

Updates the block's animator.

Member Data Documentation

◆ _animator

Animator MoreMountains.TopDownEngine.FallingPlatform2D._animator
protected

◆ _bounds

Bounds MoreMountains.TopDownEngine.FallingPlatform2D._bounds
protected

◆ _collider

Collider2D MoreMountains.TopDownEngine.FallingPlatform2D._collider
protected

◆ _contact

bool MoreMountains.TopDownEngine.FallingPlatform2D._contact = false
protected

◆ _fallStartedAt

float MoreMountains.TopDownEngine.FallingPlatform2D._fallStartedAt
protected

◆ _initialPosition

Vector3 MoreMountains.TopDownEngine.FallingPlatform2D._initialPosition
protected

◆ _newPosition

Vector2 MoreMountains.TopDownEngine.FallingPlatform2D._newPosition
protected

◆ _timeLeftBeforeFall

float MoreMountains.TopDownEngine.FallingPlatform2D._timeLeftBeforeFall
protected

◆ DelayBetweenFallAndColliderOff

float MoreMountains.TopDownEngine.FallingPlatform2D.DelayBetweenFallAndColliderOff = 0.5f

the time (in seconds) before the collider turns itself off once the fall has started

◆ InevitableFall

bool MoreMountains.TopDownEngine.FallingPlatform2D.InevitableFall = false

if this is true, the platform will fall inevitably once touched

◆ State

FallingPlatformStates MoreMountains.TopDownEngine.FallingPlatform2D.State

the current state of the falling platform

◆ TimeBeforeFall

float MoreMountains.TopDownEngine.FallingPlatform2D.TimeBeforeFall = 2f

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


The documentation for this class was generated from the following file:
  • H:/Code/MoreMountains/topdownengine/Assets/TopDownEngine/Common/Scripts/Environment/FallingPlatform2D.cs