Bandidos
Public Member Functions | Protected Member Functions | List of all members
com.mygdx.game.components.BaseGridNavigationComponent Class Referenceabstract
Inheritance diagram for com.mygdx.game.components.BaseGridNavigationComponent:
com.mygdx.game.components.GridUserComponent com.mygdx.game.engine.entities.components.BaseEntityComponent com.mygdx.game.engine.events.EventDispatcher com.mygdx.game.components.BaseEnemyAIComponent com.mygdx.game.components.BasicEnemyAIComponent

Public Member Functions

 BaseGridNavigationComponent (Grid grid, String gridOccupyTag, int xSize, int ySize)
 
void addUnwalkableOccupyTag (String tag)
 
boolean hasUnwalkableOccupyTag (String tag)
 
void removeUnwalkableOccupyTag (String tag)
 
- Public Member Functions inherited from com.mygdx.game.components.GridUserComponent
 GridUserComponent (Grid grid, String gridOccupyTag, int xSize, int ySize)
 
 GridUserComponent (Grid grid, String[] gridOccupyTags, int xSize, int ySize)
 
GridTile getCurrentLocatedTile ()
 
boolean isLocated ()
 
int getLocationX ()
 
int getLocationY ()
 
void placeSelfOnLocation (int x, int y)
 
void removeSelfFromLocation ()
 
Collection< String > getGridOccupyTags ()
 
void addGridOccupyTag (String tag)
 
void removeGridOccupyTag (String tag)
 
boolean hasGridOccupyTag (String tag)
 
void awake ()
 
- Public Member Functions inherited from com.mygdx.game.engine.entities.components.BaseEntityComponent
EngineTween startTweenOnComponent (Tween tween, TweenStartType tweenStartType)
 
Timeline startTimelineOnComponent (Timeline timeline, boolean updateInGameTime)
 
EngineTween doFloat (TweenableFloat floatToTween, float newValue, float duration, TweenStartType tweenStartType)
 
void stopAllComponentTweens ()
 
void initialize (BaseEntity parentEntity)
 
BaseEntity getParentOfComponent ()
 
boolean isActive ()
 
boolean isDestroyed ()
 
void setActiveState (boolean activeState)
 
void destroy ()
 
void update (float deltaTime)
 
abstract void awake ()
 
- Public Member Functions inherited from com.mygdx.game.engine.events.EventDispatcher
void addEventListener (String type, IEventReceiver listeningClass)
 
void dispatchEvent (Event event)
 
void removeEventListener (String type, IEventReceiver listener)
 
boolean hasEventListener (String type)
 
ArrayList< ListenerItemgetAllListeners ()
 
void destroyAllListeners ()
 
void clean ()
 

Protected Member Functions

Vector2 getNewTargetTile (float sideStepChance)
 
Vector2 getSideStep ()
 
Vector2 getTargetPosition ()
 
boolean canWalkOnTile (int tileX, int tileY)
 
Vector2 getWalkableTileOnRow (int yRow)
 
boolean hasAnyUnwalkableOccupyTag (GridTile tile)
 
- Protected Member Functions inherited from com.mygdx.game.components.GridUserComponent
Grid getGrid ()
 
void destroyed ()
 
void updated (float deltaTime)
 
void activeStateChanged ()
 
- Protected Member Functions inherited from com.mygdx.game.engine.entities.components.BaseEntityComponent
abstract void updated (float deltaTime)
 
abstract void destroyed ()
 
abstract void activeStateChanged ()
 

Additional Inherited Members

- Static Public Attributes inherited from com.mygdx.game.components.GridUserComponent
static final int NOT_LOCATED_VALUE = -1337
 

Detailed Description

All which extend this class have full access to the navigation abilities on the grid and its own position.

Author
Ramses Di Perna

Constructor & Destructor Documentation

◆ BaseGridNavigationComponent()

com.mygdx.game.components.BaseGridNavigationComponent.BaseGridNavigationComponent ( Grid  grid,
String  gridOccupyTag,
int  xSize,
int  ySize 
)

Member Function Documentation

◆ addUnwalkableOccupyTag()

void com.mygdx.game.components.BaseGridNavigationComponent.addUnwalkableOccupyTag ( String  tag)

And a tag this instance can not walk over in its orientation.

Parameters
tagrepresents the occupytag which it can not navigate over.

◆ canWalkOnTile()

boolean com.mygdx.game.components.BaseGridNavigationComponent.canWalkOnTile ( int  tileX,
int  tileY 
)
protected

Check whether the given tile is walkable for this navigator

Parameters
tileXindicates the x position of the tile on the grid (In Grid position)
tileYindicates the y position of the tile on the grid (In Grid position)
Returns

◆ getNewTargetTile()

Vector2 com.mygdx.game.components.BaseGridNavigationComponent.getNewTargetTile ( float  sideStepChance)
protected

Looks for a new target tile from its current location, here it will keep in account the side stepping, forward stepping and row searching in order to find an open tile.

Returns
The next tile in grid space

◆ getSideStep()

Vector2 com.mygdx.game.components.BaseGridNavigationComponent.getSideStep ( )
protected

Returns a random side step if able to. It will only return null when both side steps are not able to be done (Side means diagonal downwards)

Returns
The position of a side stepable tile in grid position

◆ getTargetPosition()

Vector2 com.mygdx.game.components.BaseGridNavigationComponent.getTargetPosition ( )
protected

Gets a world position on the current occupying tile.

Returns
World position random in bounce of the occupying tile

◆ getWalkableTileOnRow()

Vector2 com.mygdx.game.components.BaseGridNavigationComponent.getWalkableTileOnRow ( int  yRow)
protected

Returns the tile grid location of a walkable tile on the given y row

Parameters
yRowto check for walkable tile
Returns
The grid location of the tile

◆ hasAnyUnwalkableOccupyTag()

boolean com.mygdx.game.components.BaseGridNavigationComponent.hasAnyUnwalkableOccupyTag ( GridTile  tile)
protected

Returns whether this component holds any of the occupy tags the given tile has as 'Unwalkable'

Parameters
tileto check if its unwalkable in form of tags
Returns
True if it has any of the unwalkable tags of this component, else false (true means unwalkable, false means walkable)

◆ hasUnwalkableOccupyTag()

boolean com.mygdx.game.components.BaseGridNavigationComponent.hasUnwalkableOccupyTag ( String  tag)

Checks whether this instance has the given tag as tag it can not walk over.

Parameters
tagto check
Returns
True if it has it as "unwalkable tag", else false

◆ removeUnwalkableOccupyTag()

void com.mygdx.game.components.BaseGridNavigationComponent.removeUnwalkableOccupyTag ( String  tag)

Removes a tag which it has set as unwalkable occupy tag

Parameters
tagto remove from the unwalkable occupy tag list.

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