Bandidos
Public Member Functions | Protected Member Functions | List of all members
com.mygdx.game.components.BaseEnemyAIComponent Class Referenceabstract
Inheritance diagram for com.mygdx.game.components.BaseEnemyAIComponent:
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.BasicEnemyAIComponent

Public Member Functions

 BaseEnemyAIComponent (Playfield playfield, float movementSpeed, String[] unwalkableTags)
 
void setSideStepChance (int percentage)
 
int getSideStepChance ()
 
void awake ()
 
- Public Member Functions inherited from com.mygdx.game.components.BaseGridNavigationComponent
 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

void destroyed ()
 
float getMovementSpeed ()
 
Playfield getPlayfield ()
 
Enemy getAffectedEnemy ()
 
void moveToPlayerBase (int yRowToStop)
 
- Protected Member Functions inherited from com.mygdx.game.components.BaseGridNavigationComponent
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

This is the Base class for all the AI Components. This component holds info on the field and handles navigation to the player base. NOTE: This Component can only be attached to an entity of the class 'Enemy', else this component will give a runtime error.

Author
Ramses Di Perna

Constructor & Destructor Documentation

◆ BaseEnemyAIComponent()

com.mygdx.game.components.BaseEnemyAIComponent.BaseEnemyAIComponent ( Playfield  playfield,
float  movementSpeed,
String []  unwalkableTags 
)

Setting up the AI requires the following components (Use the method 'setSideStepChance' to also set the chance of the AI performing a side step action)

Parameters
playfieldon which the AI will interact with
movementSpeedwith which speed the AI will move the Enemy Body
unwalkableTagsare tags this particular AI instance can't walk over (A.k.a. will avoid)

Member Function Documentation

◆ awake()

void com.mygdx.game.components.BaseEnemyAIComponent.awake ( )

◆ destroyed()

void com.mygdx.game.components.BaseEnemyAIComponent.destroyed ( )
protected

◆ getAffectedEnemy()

Enemy com.mygdx.game.components.BaseEnemyAIComponent.getAffectedEnemy ( )
protected

Returns the Enemy which this component is attached to

Returns
The enemy this component is attached to.

◆ getMovementSpeed()

float com.mygdx.game.components.BaseEnemyAIComponent.getMovementSpeed ( )
protected

Returns the movement speed set for this AI Component.

Returns
A float which represents the movement speed of this Enemy AI

◆ getPlayfield()

Playfield com.mygdx.game.components.BaseEnemyAIComponent.getPlayfield ( )
protected

Returns the Playfield which was given to this component to be orientated on.

Returns
The playfield given in its constructor.

◆ getSideStepChance()

int com.mygdx.game.components.BaseEnemyAIComponent.getSideStepChance ( )

Gets the chance of this AI choosing to try a side step

Returns
The percentage which it is able to side step (between 0 and 100)

◆ moveToPlayerBase()

void com.mygdx.game.components.BaseEnemyAIComponent.moveToPlayerBase ( int  yRowToStop)
protected

This method will cause the enemy this component is attached to, to move up until the given y row to stop moving. (Moving downwards) NOTE: This should be called every frame in order to keep processing.

Parameters
yRowToStopis the Y row in grid space to stop moving.

◆ setSideStepChance()

void com.mygdx.game.components.BaseEnemyAIComponent.setSideStepChance ( int  percentage)

Sets the chance of this AI choosing to try a side step. (value between 0 - 100)

Parameters
percentagebetween 0 and 100.

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