FCV Engine 0.1
A tool and framework for tutorials in game development
Loading...
Searching...
No Matches
PlatformFinder Class Reference

Provides functionality to identify and manage walkable platform tiles in a tilemap. Implements a singleton pattern to ensure only one instance exists and offers methods for detecting platforms below a specific position, identifying the closest connected platform, and visualizing walkable areas. More...

Inheritance diagram for PlatformFinder:

Public Member Functions

Vector3Int GetPlatformBelow (Vector3 position)
 Finds the tile directly below a specified position within the tilemap. Returns a maximum vector value if no tile is found within a certain threshold.
 
List< Vector3Int > GetClosestPlatform (Vector3 position)
 Retrieves all tiles forming the closest connected platform beneath a given position. Includes tiles to the left and right, as long as they are walkable and uninterrupted.
 

Private Member Functions

void Awake ()
 Does a singleton check and if one already exists deletes itself.
 
List< Vector3Int > CheckPlatformInDirection (Vector3Int start, Vector2Int direction)
 Checks for all valid platform tiles in a specified direction, ensuring there are no overlapping obstacles above them. Continues searching until an invalid tile or obstacle is encountered.
 
void OnDrawGizmos ()
 Will display gizmos for all walkable positions if list is valid and has elements.
 

Detailed Description

Provides functionality to identify and manage walkable platform tiles in a tilemap. Implements a singleton pattern to ensure only one instance exists and offers methods for detecting platforms below a specific position, identifying the closest connected platform, and visualizing walkable areas.

Definition at line 14 of file PlatformFinder.cs.

Member Function Documentation

◆ CheckPlatformInDirection()

List< Vector3Int > CheckPlatformInDirection ( Vector3Int start,
Vector2Int direction )
private

Checks for all valid platform tiles in a specified direction, ensuring there are no overlapping obstacles above them. Continues searching until an invalid tile or obstacle is encountered.

Parameters
startThe starting tile position.
directionThe direction to search in (e.g., left or right).
Returns
A list of tile positions in the specified direction.

Definition at line 88 of file PlatformFinder.cs.

◆ GetClosestPlatform()

List< Vector3Int > GetClosestPlatform ( Vector3 position)

Retrieves all tiles forming the closest connected platform beneath a given position. Includes tiles to the left and right, as long as they are walkable and uninterrupted.

Parameters
positionThe position to search from.
Returns
A list of tile positions representing the closest connected platform.

Definition at line 66 of file PlatformFinder.cs.

◆ GetPlatformBelow()

Vector3Int GetPlatformBelow ( Vector3 position)

Finds the tile directly below a specified position within the tilemap. Returns a maximum vector value if no tile is found within a certain threshold.

Parameters
positionThe position to search from.
Returns
The tile position directly below, or a max vector if none exists.

Definition at line 41 of file PlatformFinder.cs.


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