|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.b3dgs.lionengine.game.purviews.Configurable
com.b3dgs.lionengine.game.Entity
com.b3dgs.lionengine.game.strategy.AbstractEntry<TTile,TSkill,TAttr>
com.b3dgs.lionengine.game.strategy.AbstractUnit<TTile,TSkill,TAttr>
TTile
- tile type used.TSkill
- skill type used.TAttr
- attributes type used.public abstract class AbstractUnit<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>
This class represents the main type for any kind of units. It has the ability of moving arround the map, avoiding any obstacle. It should be used for more specific unit such as builder, attacker...
Pathfindable
Field Summary | |
---|---|
Damages |
damages
Unit damages. |
protected Pathfindable |
pathfindable
|
Fields inherited from class com.b3dgs.lionengine.game.strategy.AbstractEntry |
---|
anim, animName, attr, icon, id, lastAttacker, life, map, offsetX, offsetY, sprite |
Fields inherited from class com.b3dgs.lionengine.game.Entity |
---|
collisionable, height, mirrorable, width, x, xOld, y, yOld |
Constructor Summary | |
---|---|
AbstractUnit(java.lang.String data,
PathBasedMap<TTile> map,
java.awt.image.BufferedImage surface,
TAttr attr)
Create a new unit. |
Method Summary | |
---|---|
boolean |
assignDestination(int tx,
int ty)
Assign a specified location; will move automaticaly until reach it. |
void |
clearIgnoredID()
Clear all ignored id. |
void |
follow(AbstractEntry<TTile,TSkill,TAttr> entry)
Define a target to follow. |
int |
getAngle()
Get and from current orientation. |
float |
getMoveX()
Get horizontal current speed. |
float |
getMoveY()
Get vertical current speed. |
Orientation |
getOrientation()
Get current orientation. |
Orientation |
getOrientationOld()
Get previous orientation. |
float |
getSpeedX()
Get horizontal speed. |
float |
getSpeedY()
Get vertical speed. |
AbstractEntry<TTile,TSkill,TAttr> |
getTarget()
Get entry target. |
int |
getX()
Get position x. |
int |
getXInTile()
Get horizontal tile location. |
int |
getY()
Get position y. |
int |
getYInTile()
Get vertical tile location. |
boolean |
hasReachedDestination()
Check if has reached destination. |
void |
ignoreID(int id,
boolean state)
Ignore an id while searching pathfinding. |
boolean |
isIgnoredID(int id)
Check if id is ignored. |
boolean |
isMoving()
Check is its moving. |
void |
manualMove(float dx,
float dy,
float extrp)
Move to specified destination only on call. |
abstract void |
onArrived()
Action called when entry has reached destination. |
abstract void |
onDied()
Action called when entry lost its vitality, or has been destroyed. |
abstract void |
onMove()
Action called when entry is moving. |
abstract void |
onStartMove()
Action called just before starting to move. |
boolean |
pathExists(int tx,
int ty)
Check if a path exists bewteen entity and destination. |
void |
place(int tx,
int ty)
Set specific location in tile. |
void |
pointTo(AbstractEntry<TTile,TSkill,TAttr> entry)
Adjust orientation to face to specified entry. |
void |
pointTo(int dx,
int dy)
Adjust orientation to face to specified tile. |
void |
setArrived(boolean arrived)
Set arrived state (used to separate the arriving & arrived case). |
void |
setHackNSlash(boolean state)
Deprecated. |
void |
setOrientation(Orientation orientation)
Set specific orientation. |
void |
setSpeed(float speedX,
float speedY)
Set move speed. |
void |
setTarget(AbstractEntry<TTile,TSkill,TAttr> entry)
Set entry target. |
void |
stop()
Stop any action, reset all states. |
void |
stopMoves()
Stop any pathfinding movements. |
void |
update(Keyboard keyboard,
Mouse mouse,
float extrp)
This function can be overrided, be you should call super.update first, as it already does standard updates (updateMirror & updateMoves). |
void |
updateMirror()
Deprecated. Call update function instead, as it override it. Call it manually only if you plan a specific update. |
void |
updateMoves(float extrp)
Deprecated. Call update function instead, as it override it. Call it manually only if you plan a specific update. |
Methods inherited from class com.b3dgs.lionengine.game.strategy.AbstractEntry |
---|
addSkill, applyOrder, applyOrder, getAnimState, getDistance, getDistance, getFieldOfView, getFrame, getHeight, getHeightInTile, getLayer, getLayerOld, getOrderedSkill, getOwnerID, getRealFrame, getSkill, getSkills, getWidth, getWidthInTile, getXOffset, getYOffset, hasChangedLayer, isActive, isAlive, isOver, isRemoved, isSelected, isUnselected, isVisible, onHit, onKilled, onOrdered, onOrderedFail, onSelection, play, play, play, remove, removeRef, removeSkill, render, setActive, setAlive, setAnimation, setFieldOfView, setFrame, setLayer, setLayerChanged, setOrderedSkill, setOver, setOwnerID, setSelection, setSkipLastFrameOnReverse, setVisibility, stopAnimation, unselect, updateAnimation |
Methods inherited from class com.b3dgs.lionengine.game.Entity |
---|
backupCoord, cancelMirror, collide, collide, getCancelMirror, getCollision, getMirror, getRay, getXOld, getXReal, getYOld, getYReal, invertYAxis, mirror, move, renderCollision, updateCollision |
Methods inherited from class com.b3dgs.lionengine.game.purviews.Configurable |
---|
checkInstruction, getAnim, getCollArea, getData, getDataBool, getDataInt, getDataString, getRange, loadData |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final Damages damages
protected final Pathfindable pathfindable
Constructor Detail |
---|
public AbstractUnit(java.lang.String data, PathBasedMap<TTile> map, java.awt.image.BufferedImage surface, TAttr attr)
data
- unit data file path.map
- map reference.surface
- building image file path.attr
- attributes reference.Method Detail |
---|
public void manualMove(float dx, float dy, float extrp)
Pathfindable
manualMove
in interface Pathfindable
dx
- destination x.dy
- destination y.extrp
- extrapolation value.public boolean assignDestination(int tx, int ty)
Pathfindable
assignDestination
in interface Pathfindable
tx
- destination x (in tile map).ty
- destination y (in tile map).
public void stopMoves()
Pathfindable
stopMoves
in interface Pathfindable
public void follow(AbstractEntry<TTile,TSkill,TAttr> entry)
entry
- target.public void stop()
public void setTarget(AbstractEntry<TTile,TSkill,TAttr> entry)
entry
- entry target.public AbstractEntry<TTile,TSkill,TAttr> getTarget()
public void update(Keyboard keyboard, Mouse mouse, float extrp)
update
in class AbstractEntry<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>
keyboard
- keyboard reference.mouse
- mouse reference.extrp
- extrapolation value.@Deprecated public void updateMirror()
Mirrorable
updateMirror
in interface Mirrorable
updateMirror
in class Entity
@Deprecated public void updateMoves(float extrp)
Pathfindable
updateMoves
in interface Pathfindable
extrp
- extrapolation value.public void place(int tx, int ty)
AbstractEntry
place
in interface Pathfindable
place
in class AbstractEntry<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>
tx
- horizontal tile location.ty
- vertical tile location.public void ignoreID(int id, boolean state)
Pathfindable
ignoreID
in interface Pathfindable
id
- id to ignore.state
- true to ignore, false else.public boolean isIgnoredID(int id)
Pathfindable
isIgnoredID
in interface Pathfindable
id
- id to check.
public void clearIgnoredID()
Pathfindable
clearIgnoredID
in interface Pathfindable
public boolean pathExists(int tx, int ty)
Pathfindable
pathExists
in interface Pathfindable
tx
- destination x (in tile map).ty
- destination y (in tile map).
public void setArrived(boolean arrived)
Pathfindable
setArrived
in interface Pathfindable
arrived
- arrived state.public boolean isMoving()
Pathfindable
isMoving
in interface Pathfindable
public boolean hasReachedDestination()
Pathfindable
hasReachedDestination
in interface Pathfindable
public void setSpeed(float speedX, float speedY)
Pathfindable
setSpeed
in interface Pathfindable
speedX
- horizontal speed.speedY
- vertical speed.public float getSpeedX()
Pathfindable
getSpeedX
in interface Pathfindable
public float getSpeedY()
Pathfindable
getSpeedY
in interface Pathfindable
public float getMoveX()
Pathfindable
getMoveX
in interface Pathfindable
public float getMoveY()
Pathfindable
getMoveY
in interface Pathfindable
public int getX()
Entity
getX
in interface Pathfindable
getX
in class Entity
public int getY()
Entity
getY
in interface Pathfindable
getY
in class Entity
public int getXInTile()
AbstractEntry
getXInTile
in interface Pathfindable
getXInTile
in class AbstractEntry<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>
public int getYInTile()
AbstractEntry
getYInTile
in interface Pathfindable
getYInTile
in class AbstractEntry<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>
public Orientation getOrientation()
public Orientation getOrientationOld()
public void setOrientation(Orientation orientation)
orientation
- new orientation.public void pointTo(AbstractEntry<TTile,TSkill,TAttr> entry)
entry
- entry to face.public void pointTo(int dx, int dy)
dx
- horizontal tile to face.dy
- vertical tile to face.public int getAngle()
@Deprecated public final void setHackNSlash(boolean state)
Pathfindable
setHackNSlash
in interface Pathfindable
state
- state.public abstract void onStartMove()
public abstract void onMove()
public abstract void onArrived()
public abstract void onDied()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |