Add this component to a one way platform (a platform with an edge collider, on the OneWayPlatforms layer) and it will automatically turn its collider on or off based on the player position, letting you easily move it around, and will also let the player collide with it laterally, like a mid height one way platform would, but regardless of its placement or rotation. It's slightly more costly than a regular, static one, but will offer more options too
More...
|
int | PlayerID = 0 |
| the ID of the target Player to consider for this platform - usually 0 More...
|
|
Vector2 | Offset |
| the offset to consider for the player's position - usually 0,0 More...
|
|
bool | AutoAdaptOffsetBasedOnPlayerHeight = true |
| if this is true, this component will try to automatically adapt its offset based on the player's dimensions More...
|
|
bool | CacheWorldCoordinatesEveryFrame = false |
| if this is true, the platform's coordinates will be recomputed every frame, only turn this on if your platform moves. Ideally you'll want to keep this off and manually call CacheColliderWorldCoordinates() every time your platform moves More...
|
|
bool | Inverted = false |
| if this is false, the platform will turn itself off when the player is below it, and on otherwise. If Inverted is set to true, then the platform will turn itself off when the player is above, and on when it's below More...
|
|
Add this component to a one way platform (a platform with an edge collider, on the OneWayPlatforms layer) and it will automatically turn its collider on or off based on the player position, letting you easily move it around, and will also let the player collide with it laterally, like a mid height one way platform would, but regardless of its placement or rotation. It's slightly more costly than a regular, static one, but will offer more options too
◆ Awake()
virtual void MoreMountains.CorgiEngine.AnyHeightOneWayPlatform.Awake |
( |
| ) |
|
|
protectedvirtual |
On Awake we initialize our platform
◆ CacheColliderWorldCoordinates()
virtual void MoreMountains.CorgiEngine.AnyHeightOneWayPlatform.CacheColliderWorldCoordinates |
( |
| ) |
|
|
virtual |
Stores the positions of the platform's edges
◆ GrabTargetPlayer()
virtual void MoreMountains.CorgiEngine.AnyHeightOneWayPlatform.GrabTargetPlayer |
( |
| ) |
|
|
virtual |
Stores the target player character
◆ HandleColliderBasedOnPlayerPosition()
virtual void MoreMountains.CorgiEngine.AnyHeightOneWayPlatform.HandleColliderBasedOnPlayerPosition |
( |
| ) |
|
|
protectedvirtual |
Turns the collider on if the player is above it, off otherwise
◆ Initialization()
virtual void MoreMountains.CorgiEngine.AnyHeightOneWayPlatform.Initialization |
( |
| ) |
|
|
virtual |
Stores the collider and computes its points' world coordinates
◆ LateUpdate()
virtual void MoreMountains.CorgiEngine.AnyHeightOneWayPlatform.LateUpdate |
( |
| ) |
|
|
protectedvirtual |
On LateUpdate we turn our collider on or off
◆ PlayerIsAbove()
virtual bool MoreMountains.CorgiEngine.AnyHeightOneWayPlatform.PlayerIsAbove |
( |
| ) |
|
|
protectedvirtual |
Returns true if the player is above the platform, false otherwise
- Returns
◆ _edgeA
Vector2 MoreMountains.CorgiEngine.AnyHeightOneWayPlatform._edgeA |
|
protected |
◆ _edgeB
Vector2 MoreMountains.CorgiEngine.AnyHeightOneWayPlatform._edgeB |
|
protected |
◆ _edgeCollider2D
EdgeCollider2D MoreMountains.CorgiEngine.AnyHeightOneWayPlatform._edgeCollider2D |
|
protected |
◆ _playerTransform
Transform MoreMountains.CorgiEngine.AnyHeightOneWayPlatform._playerTransform |
|
protected |
◆ AutoAdaptOffsetBasedOnPlayerHeight
bool MoreMountains.CorgiEngine.AnyHeightOneWayPlatform.AutoAdaptOffsetBasedOnPlayerHeight = true |
if this is true, this component will try to automatically adapt its offset based on the player's dimensions
◆ CacheWorldCoordinatesEveryFrame
bool MoreMountains.CorgiEngine.AnyHeightOneWayPlatform.CacheWorldCoordinatesEveryFrame = false |
if this is true, the platform's coordinates will be recomputed every frame, only turn this on if your platform moves. Ideally you'll want to keep this off and manually call CacheColliderWorldCoordinates() every time your platform moves
◆ Inverted
bool MoreMountains.CorgiEngine.AnyHeightOneWayPlatform.Inverted = false |
if this is false, the platform will turn itself off when the player is below it, and on otherwise. If Inverted is set to true, then the platform will turn itself off when the player is above, and on when it's below
◆ Offset
Vector2 MoreMountains.CorgiEngine.AnyHeightOneWayPlatform.Offset |
the offset to consider for the player's position - usually 0,0
◆ PlayerID
int MoreMountains.CorgiEngine.AnyHeightOneWayPlatform.PlayerID = 0 |
the ID of the target Player to consider for this platform - usually 0
◆ PlayerPositionX
virtual float MoreMountains.CorgiEngine.AnyHeightOneWayPlatform.PlayerPositionX => _playerTransform.position.x + Offset.x |
|
protected |
The x position of the player
◆ PlayerPositionY
virtual float MoreMountains.CorgiEngine.AnyHeightOneWayPlatform.PlayerPositionY => _playerTransform.position.y + Offset.y |
|
protected |
The y position of the player
The documentation for this class was generated from the following file: