Eye of the Nile Docs
Everything you need to know to get started!
Loading...
Searching...
No Matches
MovingPlatform Class Reference

Detailed Description

Moves the moving platforms and the entities on it. Each moving platform has its own MovingPlatform script attached.

Documentation updated 12/23/2024

Author
Alexander Art
Todo

Prevent entities from clipping into walls when being pushed into them.

Prevent colliding moving platforms from sticking together (or just never place them in each other's path).

Public Attributes

float moveSpeed = 2.5f
 The speed at which the platform will move at.
 
float pauseDuration = 1f
 The amount of time the platform will stop between each point (in seconds).
 

Protected Attributes

MovableEntityDetector entityDetector
 Detects the entities that are standing on the platform (controlled by a different script).
 
Transform path
 The object with children as the points that the platform will move between.
 

Private Member Functions

void Awake ()
 Set reference to the moving platform's rigidbody and initial target point.
 
void Update ()
 

Private Attributes

Rigidbody2D rb
 Reference to the platform's rigidbody component.
 
float pauseCounter = 0f
 Keeps track of how long the platform has been stopped before going to a new point (in seconds).
 
Transform targetPoint
 The point that the platform should be moving towards.
 
int targetPointIndex = 0
 Keeps track of which point the platform should be moving towards.
 
Vector2 previousPosition
 Needed for calculating how far the platform has moved each frame when updating the position of entities standing atop.
 

Member Function Documentation

◆ Awake()

void MovingPlatform.Awake ( )
private

Set reference to the moving platform's rigidbody and initial target point.

◆ Update()

void MovingPlatform.Update ( )
private

Member Data Documentation

◆ entityDetector

MovableEntityDetector MovingPlatform.entityDetector
protected

Detects the entities that are standing on the platform (controlled by a different script).

◆ moveSpeed

float MovingPlatform.moveSpeed = 2.5f

The speed at which the platform will move at.

◆ path

Transform MovingPlatform.path
protected

The object with children as the points that the platform will move between.

◆ pauseCounter

float MovingPlatform.pauseCounter = 0f
private

Keeps track of how long the platform has been stopped before going to a new point (in seconds).

◆ pauseDuration

float MovingPlatform.pauseDuration = 1f

The amount of time the platform will stop between each point (in seconds).

◆ previousPosition

Vector2 MovingPlatform.previousPosition
private

Needed for calculating how far the platform has moved each frame when updating the position of entities standing atop.

◆ rb

Rigidbody2D MovingPlatform.rb
private

Reference to the platform's rigidbody component.

◆ targetPoint

Transform MovingPlatform.targetPoint
private

The point that the platform should be moving towards.

◆ targetPointIndex

int MovingPlatform.targetPointIndex = 0
private

Keeps track of which point the platform should be moving towards.


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