TopDown Engine  v3.6
MoreMountains.TopDownEngine.FallingPlatform3D 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.FallingPlatform3D:
MoreMountains.TopDownEngine.TopDownMonoBehaviour MoreMountains.Tools.MMMonoBehaviour

Public Types

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

Public Member Functions

virtual void OnTriggerStay (Collider collider)
 Triggered when a TopDownController touches the platform More...
 

Public Attributes

FallingPlatformStates State
 the platform's current state More...
 
bool InevitableFall = false
 if this is true, the platform will fall inevitably once touched More...
 
float TimeBeforeFall = 2f
 the time (in seconds) before the fall of the platform More...
 
bool UsePhysics = true
 if this is true, the object's rigidbody will be turned non kinematic when falling. Only works in 3D. More...
 
float NonPhysicsFallSpeed = 2f
 the speed at which the platforms falls 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 OnTriggerExit (Collider collider)
 Triggered when a TopDownController exits the platform More...
 
virtual void OnRevive ()
 On Revive we restore this platform's state More...
 

Protected Attributes

Animator _animator
 
Vector2 _newPosition
 
Bounds _bounds
 
Collider _collider
 
Vector3 _initialPosition
 
float _timer
 
float _platformTopY
 
Rigidbody _rigidbody
 
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 platform

Enumerator
Idle 
Shaking 
Falling 

Member Function Documentation

◆ DisableFallingPlatform()

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

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

◆ FixedUpdate()

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

This is called every frame.

◆ Initialization()

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

Grabs components and saves initial position and timer

◆ OnRevive()

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

On Revive we restore this platform's state

◆ OnTriggerExit()

virtual void MoreMountains.TopDownEngine.FallingPlatform3D.OnTriggerExit ( Collider  collider)
protectedvirtual

Triggered when a TopDownController exits the platform

Parameters
controllerThe TopDown controller that collides with the platform.

◆ OnTriggerStay()

virtual void MoreMountains.TopDownEngine.FallingPlatform3D.OnTriggerStay ( Collider  collider)
virtual

Triggered when a TopDownController touches the platform

Parameters
controllerThe TopDown controller that collides with the platform.


◆ Start()

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

Initialization

◆ UpdateAnimator()

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

Updates the block's animator.

Member Data Documentation

◆ _animator

Animator MoreMountains.TopDownEngine.FallingPlatform3D._animator
protected

◆ _bounds

Bounds MoreMountains.TopDownEngine.FallingPlatform3D._bounds
protected

◆ _collider

Collider MoreMountains.TopDownEngine.FallingPlatform3D._collider
protected

◆ _contact

bool MoreMountains.TopDownEngine.FallingPlatform3D._contact = false
protected

◆ _initialPosition

Vector3 MoreMountains.TopDownEngine.FallingPlatform3D._initialPosition
protected

◆ _newPosition

Vector2 MoreMountains.TopDownEngine.FallingPlatform3D._newPosition
protected

◆ _platformTopY

float MoreMountains.TopDownEngine.FallingPlatform3D._platformTopY
protected

◆ _rigidbody

Rigidbody MoreMountains.TopDownEngine.FallingPlatform3D._rigidbody
protected

◆ _timer

float MoreMountains.TopDownEngine.FallingPlatform3D._timer
protected

◆ InevitableFall

bool MoreMountains.TopDownEngine.FallingPlatform3D.InevitableFall = false

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

◆ NonPhysicsFallSpeed

float MoreMountains.TopDownEngine.FallingPlatform3D.NonPhysicsFallSpeed = 2f

the speed at which the platforms falls

◆ State

FallingPlatformStates MoreMountains.TopDownEngine.FallingPlatform3D.State

the platform's current state

◆ TimeBeforeFall

float MoreMountains.TopDownEngine.FallingPlatform3D.TimeBeforeFall = 2f

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

◆ UsePhysics

bool MoreMountains.TopDownEngine.FallingPlatform3D.UsePhysics = true

if this is true, the object's rigidbody will be turned non kinematic when falling. Only works in 3D.


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