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

Add this component to a platform and it'll be able to follow a path and carry a character More...

Inheritance diagram for MoreMountains.CorgiEngine.MovingPlatform:
MoreMountains.Tools.MMPathMovement MoreMountains.CorgiEngine.Respawnable MoreMountains.Tools.MMEventListener< CorgiEngineEvent >

Public Member Functions

override void MoveAlongThePath ()
 Moves the object along the path according to the specified movement type. More...
 
virtual void SetMovementAuthorization (bool status)
 Sets the movement authorization to true or false based on the status set in parameter More...
 
virtual void AuthorizeMovement ()
 Sets the script authorization to true More...
 
virtual void ForbidMovement ()
 Sets the script authorization to false More...
 
virtual void ToggleMovementAuthorization ()
 Sets the script authorization to true if it was false, false if it was true More...
 
virtual void ResetEndReached ()
 Resets the end reached status, allowing you to move in the opposite direction if CycleOption is set to StopAtBounds More...
 
virtual void MoveTowardsStart ()
 Forces the moving platform to move back to its start position More...
 
virtual void MoveTowardsEnd ()
 Forces the moving platform to move to its end position More...
 
virtual void OnTriggerEnter2D (Collider2D collider)
 When entering collision with something, we check if it's a player, and in that case we set our flag accordingly More...
 
virtual void OnTriggerExit2D (Collider2D collider)
 When exiting collision with something, we check if it's a player, and in that case we set our flag accordingly More...
 
virtual void OnPlayerRespawn (CheckPoint checkpoint, Character player)
 When the player respawns, we reset the position and behaviour of this moving platform More...
 
virtual void OnMMEvent (CorgiEngineEvent eventType)
 Catches respawn events and resets the platform's position if needed More...
 
- Public Member Functions inherited from MoreMountains.Tools.MMPathMovement
virtual void ResetPath ()
 A public method you can call to reset the path More...
 
virtual IEnumerator< Vector3 > GetPathEnumerator ()
 Returns the current target point in the path More...
 
virtual void ChangeDirection ()
 Call this method to force a change in direction at any time More...
 
virtual Vector3 PointPosition (int index)
 
virtual Vector3 PointPosition (Vector3 relativePointPosition)
 
virtual void UpdateOriginalTransformPosition (Vector3 newOriginalTransformPosition)
 Updates the original transform position. More...
 
virtual Vector3 GetOriginalTransformPosition ()
 Gets the original transform position. More...
 
virtual void SetOriginalTransformPositionStatus (bool status)
 Sets the original transform position status. More...
 
virtual bool GetOriginalTransformPositionStatus ()
 Gets the original transform position status. More...
 
- Public Member Functions inherited from MoreMountains.Tools.MMEventListener< CorgiEngineEvent >
void OnMMEvent (T eventType)
 

Public Attributes

bool OnlyMovesWhenPlayerIsColliding = false
 If true, the object will only move when colliding with the player. More...
 
bool OnlyMovesWhenCharacterIsColliding = false
 if true, the object will only move if a character is colliding More...
 
bool ResetPositionWhenPlayerRespawns = false
 If true, this moving platform will reset position and behaviour when the player respawns. More...
 
bool ScriptActivated = false
 If true, this platform will only moved when commanded to by another script. More...
 
bool StartMovingWhenPlayerIsColliding = false
 If true, the object will start moving when a player collides with it. This requires that ScriptActivated be set to true (and it will set it to true on init otherwise) More...
 
bool ToggleButton
 
bool ChangeDirectionButton
 
bool ResetEndReachedButton
 
bool MoveTowardsStartButton
 
bool MoveTowardsEndButton
 
MMFeedbacks PointReachedFeedback
 a feedback to trigger when a new point is reached More...
 
MMFeedbacks EndReachedFeedback
 a feedback to trigger when the end of the path is reached More...
 
UnityEvent OnCharacterEnter
 a UnityEvent fired when a character collides with the platform More...
 
UnityEvent OnCharacterExit
 a UnityEvent fired when a character exits the platform More...
 
- Public Attributes inherited from MoreMountains.Tools.MMPathMovement
CycleOptions CycleOption
 
MovementDirection LoopInitialMovementDirection = MovementDirection.Ascending
 the initial movement direction : ascending > will go from the points 0 to 1, 2, etc ; descending > will go from the last point to last-1, last-2, etc More...
 
List< MMPathMovementElementPathElements
 the points that make up the path the object will follow More...
 
AlignmentModes AlignmentMode = AlignmentModes.None
 whether to align the path on nothing, this object's rotation, or this object's parent's rotation More...
 
float MovementSpeed = 1
 the movement speed More...
 
PossibleAccelerationType AccelerationType = PossibleAccelerationType.ConstantSpeed
 the movement type of the object More...
 
AnimationCurve Acceleration = new AnimationCurve(new Keyframe(0,1f),new Keyframe(1f,0f))
 the acceleration to apply to an object traveling between two points of the path. More...
 
UpdateModes UpdateMode = UpdateModes.Update
 the chosen update mode (update, fixed update, late update) More...
 
float MinDistanceToGoal = .1f
 the minimum distance to a point at which we'll arbitrarily decide the point's been reached More...
 

Protected Member Functions

override void Initialization ()
 Flag inits, initial movement determination, and object positioning More...
 
override void Update ()
 On Update, we check if we've started or stopped colliding with a controller, and trigger events if needed More...
 
override void PointReached ()
 Override this to describe what happens when a point is reached More...
 
override void EndReached ()
 Override this to describe what happens when the end of the path is reached More...
 
virtual void OnEnable ()
 On enable, starts listening for CorgiEngine events More...
 
virtual void OnDisable ()
 On disable, stops listening for CorgiEngine events More...
 
- Protected Member Functions inherited from MoreMountains.Tools.MMPathMovement
virtual void Awake ()
 Initialization More...
 
virtual void Start ()
 On Start we store our initial position More...
 
virtual void FixedUpdate ()
 
virtual void LateUpdate ()
 
virtual void ExecuteUpdate ()
 On update we keep moving along the path More...
 
virtual void Move ()
 Moves the object and determines when a point has been reached More...
 
virtual void OnDrawGizmos ()
 On DrawGizmos, we draw lines to show the path the object will follow More...
 

Protected Attributes

Collider2D _collider2D
 
float _platformTopY
 
bool _scriptActivatedAuthorization = false
 
CorgiController _corgiControllerLastFrame
 
CorgiController _collidingController = null
 
bool _collidingWithPlayer
 
- Protected Attributes inherited from MoreMountains.Tools.MMPathMovement
Vector3 _originalTransformPosition
 the original position of the transform, hidden and shouldn't be accessed More...
 
bool _originalTransformPositionStatus = false
 
bool _active =false
 
IEnumerator< Vector3 > _currentPoint
 
int _direction = 1
 
Vector3 _initialPosition
 
Vector3 _finalPosition
 
Vector3 _previousPoint = Vector3.zero
 
float _waiting =0
 
int _currentIndex
 
float _distanceToNextPoint
 
bool _endReached = false
 
Vector3 _positionLastFrame
 
Vector3 _vector3Zero = Vector3.zero
 

Static Protected Attributes

const float _toleranceY = 0.05f
 

Properties

override bool? CanMove [get]
 Gets a value indicating whether this instance can move. More...
 
- Properties inherited from MoreMountains.Tools.MMPathMovement
virtual Vector3 CurrentSpeed [get, protected set]
 returns the current speed at which the object is traveling More...
 
virtual bool CanMove [get, set]
 if this is true, the object can move along the path More...
 

Additional Inherited Members

- Public Types inherited from MoreMountains.Tools.MMPathMovement
enum  PossibleAccelerationType { PossibleAccelerationType.ConstantSpeed, PossibleAccelerationType.EaseOut, PossibleAccelerationType.AnimationCurve }
 the possible movement types More...
 
enum  CycleOptions {
  CycleOptions.BackAndForth, CycleOptions.Loop, CycleOptions.OnlyOnce, CycleOptions.StopAtBounds,
  CycleOptions.Random
}
 the possible cycle options More...
 
enum  MovementDirection { MovementDirection.Ascending, MovementDirection.Descending }
 the possible movement directions More...
 
enum  UpdateModes { UpdateModes.Update, UpdateModes.FixedUpdate, UpdateModes.LateUpdate }
 whether progress on the pass should be made at update, fixed update or late update More...
 
enum  AlignmentModes { AlignmentModes.None, AlignmentModes.ThisRotation, AlignmentModes.ParentRotation }
 whether to align the path on nothing, this object's rotation, or this object's parent's rotation More...
 

Detailed Description

Add this component to a platform and it'll be able to follow a path and carry a character

Member Function Documentation

◆ AuthorizeMovement()

virtual void MoreMountains.CorgiEngine.MovingPlatform.AuthorizeMovement ( )
virtual

Sets the script authorization to true

◆ EndReached()

override void MoreMountains.CorgiEngine.MovingPlatform.EndReached ( )
protectedvirtual

Override this to describe what happens when the end of the path is reached

Reimplemented from MoreMountains.Tools.MMPathMovement.

◆ ForbidMovement()

virtual void MoreMountains.CorgiEngine.MovingPlatform.ForbidMovement ( )
virtual

Sets the script authorization to false

◆ Initialization()

override void MoreMountains.CorgiEngine.MovingPlatform.Initialization ( )
protectedvirtual

Flag inits, initial movement determination, and object positioning

Reimplemented from MoreMountains.Tools.MMPathMovement.

◆ MoveAlongThePath()

override void MoreMountains.CorgiEngine.MovingPlatform.MoveAlongThePath ( )
virtual

Moves the object along the path according to the specified movement type.

Reimplemented from MoreMountains.Tools.MMPathMovement.

◆ MoveTowardsEnd()

virtual void MoreMountains.CorgiEngine.MovingPlatform.MoveTowardsEnd ( )
virtual

Forces the moving platform to move to its end position

◆ MoveTowardsStart()

virtual void MoreMountains.CorgiEngine.MovingPlatform.MoveTowardsStart ( )
virtual

Forces the moving platform to move back to its start position

◆ OnDisable()

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

On disable, stops listening for CorgiEngine events

◆ OnEnable()

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

On enable, starts listening for CorgiEngine events

◆ OnMMEvent()

virtual void MoreMountains.CorgiEngine.MovingPlatform.OnMMEvent ( CorgiEngineEvent  eventType)
virtual

Catches respawn events and resets the platform's position if needed

Parameters
eventType

◆ OnPlayerRespawn()

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

When the player respawns, we reset the position and behaviour of this moving platform

Parameters
checkpointCheckpoint.
playerPlayer.

Implements MoreMountains.CorgiEngine.Respawnable.

◆ OnTriggerEnter2D()

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

When entering collision with something, we check if it's a player, and in that case we set our flag accordingly

Parameters
colliderCollider.

◆ OnTriggerExit2D()

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

When exiting collision with something, we check if it's a player, and in that case we set our flag accordingly

Parameters
colliderCollider.

◆ PointReached()

override void MoreMountains.CorgiEngine.MovingPlatform.PointReached ( )
protectedvirtual

Override this to describe what happens when a point is reached

Reimplemented from MoreMountains.Tools.MMPathMovement.

◆ ResetEndReached()

virtual void MoreMountains.CorgiEngine.MovingPlatform.ResetEndReached ( )
virtual

Resets the end reached status, allowing you to move in the opposite direction if CycleOption is set to StopAtBounds

◆ SetMovementAuthorization()

virtual void MoreMountains.CorgiEngine.MovingPlatform.SetMovementAuthorization ( bool  status)
virtual

Sets the movement authorization to true or false based on the status set in parameter

Parameters
status

◆ ToggleMovementAuthorization()

virtual void MoreMountains.CorgiEngine.MovingPlatform.ToggleMovementAuthorization ( )
virtual

Sets the script authorization to true if it was false, false if it was true

◆ Update()

override void MoreMountains.CorgiEngine.MovingPlatform.Update ( )
protectedvirtual

On Update, we check if we've started or stopped colliding with a controller, and trigger events if needed

Reimplemented from MoreMountains.Tools.MMPathMovement.

Member Data Documentation

◆ _collider2D

Collider2D MoreMountains.CorgiEngine.MovingPlatform._collider2D
protected

◆ _collidingController

CorgiController MoreMountains.CorgiEngine.MovingPlatform._collidingController = null
protected

◆ _collidingWithPlayer

bool MoreMountains.CorgiEngine.MovingPlatform._collidingWithPlayer
protected

◆ _corgiControllerLastFrame

CorgiController MoreMountains.CorgiEngine.MovingPlatform._corgiControllerLastFrame
protected

◆ _platformTopY

float MoreMountains.CorgiEngine.MovingPlatform._platformTopY
protected

◆ _scriptActivatedAuthorization

bool MoreMountains.CorgiEngine.MovingPlatform._scriptActivatedAuthorization = false
protected

◆ _toleranceY

const float MoreMountains.CorgiEngine.MovingPlatform._toleranceY = 0.05f
staticprotected

◆ ChangeDirectionButton

bool MoreMountains.CorgiEngine.MovingPlatform.ChangeDirectionButton

◆ EndReachedFeedback

MMFeedbacks MoreMountains.CorgiEngine.MovingPlatform.EndReachedFeedback

a feedback to trigger when the end of the path is reached

◆ MoveTowardsEndButton

bool MoreMountains.CorgiEngine.MovingPlatform.MoveTowardsEndButton

◆ MoveTowardsStartButton

bool MoreMountains.CorgiEngine.MovingPlatform.MoveTowardsStartButton

◆ OnCharacterEnter

UnityEvent MoreMountains.CorgiEngine.MovingPlatform.OnCharacterEnter

a UnityEvent fired when a character collides with the platform

◆ OnCharacterExit

UnityEvent MoreMountains.CorgiEngine.MovingPlatform.OnCharacterExit

a UnityEvent fired when a character exits the platform

◆ OnlyMovesWhenCharacterIsColliding

bool MoreMountains.CorgiEngine.MovingPlatform.OnlyMovesWhenCharacterIsColliding = false

if true, the object will only move if a character is colliding

◆ OnlyMovesWhenPlayerIsColliding

bool MoreMountains.CorgiEngine.MovingPlatform.OnlyMovesWhenPlayerIsColliding = false

If true, the object will only move when colliding with the player.

◆ PointReachedFeedback

MMFeedbacks MoreMountains.CorgiEngine.MovingPlatform.PointReachedFeedback

a feedback to trigger when a new point is reached

◆ ResetEndReachedButton

bool MoreMountains.CorgiEngine.MovingPlatform.ResetEndReachedButton

◆ ResetPositionWhenPlayerRespawns

bool MoreMountains.CorgiEngine.MovingPlatform.ResetPositionWhenPlayerRespawns = false

If true, this moving platform will reset position and behaviour when the player respawns.

◆ ScriptActivated

bool MoreMountains.CorgiEngine.MovingPlatform.ScriptActivated = false

If true, this platform will only moved when commanded to by another script.

◆ StartMovingWhenPlayerIsColliding

bool MoreMountains.CorgiEngine.MovingPlatform.StartMovingWhenPlayerIsColliding = false

If true, the object will start moving when a player collides with it. This requires that ScriptActivated be set to true (and it will set it to true on init otherwise)

◆ ToggleButton

bool MoreMountains.CorgiEngine.MovingPlatform.ToggleButton

Property Documentation

◆ CanMove

override bool? MoreMountains.CorgiEngine.MovingPlatform.CanMove
get

Gets a value indicating whether this instance can move.

true if this instance can move; otherwise, false.


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