com.b3dgs.lionengine.game.hacknslash
Class AbstractHero<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>

java.lang.Object
  extended by com.b3dgs.lionengine.game.purviews.Configurable
      extended by com.b3dgs.lionengine.game.Entity
          extended by com.b3dgs.lionengine.game.strategy.AbstractEntry<TTile,TSkill,TAttr>
              extended by com.b3dgs.lionengine.game.strategy.AbstractUnit<TTile,TSkill,TAttr>
                  extended by com.b3dgs.lionengine.game.hacknslash.AbstractHero<TTile,TSkill,TAttr>
All Implemented Interfaces:
Animator, Collisionable, Mirrorable, Pathfindable, AttackerAbility<TTile,TSkill,TAttr>

public abstract class AbstractHero<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>
extends AbstractUnit<TTile,TSkill,TAttr>
implements AttackerAbility<TTile,TSkill,TAttr>


Field Summary
 
Fields inherited from class com.b3dgs.lionengine.game.strategy.AbstractUnit
damages, 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
AbstractHero(java.lang.String data, PathBasedMap<TTile> map, java.lang.String surface, boolean alpha, TAttr attr)
           
 
Method Summary
 void addAttack(int num, AttackerAbility<TTile,TSkill,TAttr> attack)
           
 void attack(AbstractEntry<TTile,TSkill,TAttr> entry)
          Define a target to attack.
 boolean isAttacking()
          Check if entry is attacking.
 void onSelection()
          Action called when entry is selected (in case of a single selection).
 void setAttack(int num)
           
 void setAttackFrame(int frame)
          Represent the frame number (inside animation) which design the attack action.
 void setAttackTimer(int time)
          Set attack pause time between two attacks.
 void setMaximalAttackDistance(int max)
          Set maximum attack distance bewteen entry and target.
 void setMinimalAttackDistance(int min)
          Set minimum attack distance bewteen entry and target.
 void stop()
          Stop any action, reset all states.
 void stopAttack()
          Stop any action, reset all states.
 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 updateAttack(float extrp)
          Deprecated. 
 
Methods inherited from class com.b3dgs.lionengine.game.strategy.AbstractUnit
assignDestination, clearIgnoredID, follow, getAngle, getMoveX, getMoveY, getOrientation, getOrientationOld, getSpeedX, getSpeedY, getTarget, getX, getXInTile, getY, getYInTile, hasReachedDestination, ignoreID, isIgnoredID, isMoving, manualMove, onArrived, onDied, onMove, onStartMove, pathExists, place, pointTo, pointTo, setArrived, setHackNSlash, setOrientation, setSpeed, setTarget, stopMoves, updateMirror, updateMoves
 
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, 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
 

Constructor Detail

AbstractHero

public AbstractHero(java.lang.String data,
                    PathBasedMap<TTile> map,
                    java.lang.String surface,
                    boolean alpha,
                    TAttr attr)
Method Detail

addAttack

public void addAttack(int num,
                      AttackerAbility<TTile,TSkill,TAttr> attack)

update

public void update(Keyboard keyboard,
                   Mouse mouse,
                   float extrp)
Description copied from class: AbstractUnit
This function can be overrided, be you should call super.update first, as it already does standard updates (updateMirror & updateMoves).

Overrides:
update in class AbstractUnit<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>
Parameters:
keyboard - keyboard reference.
mouse - mouse reference.
extrp - extrapolation value.

stop

public void stop()
Description copied from class: AbstractUnit
Stop any action, reset all states.

Overrides:
stop in class AbstractUnit<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>

onSelection

public void onSelection()
Description copied from class: AbstractEntry
Action called when entry is selected (in case of a single selection).

Specified by:
onSelection in class AbstractEntry<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>

setAttack

public void setAttack(int num)

updateAttack

@Deprecated
public void updateAttack(float extrp)
Deprecated. 

Description copied from interface: AttackerAbility
Update attack routine.

Specified by:
updateAttack in interface AttackerAbility<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>
Parameters:
extrp - extrapolation value.

attack

public void attack(AbstractEntry<TTile,TSkill,TAttr> entry)
Description copied from interface: AttackerAbility
Define a target to attack. Entry will move to target location. Automaticaly updated if target is moving.

Specified by:
attack in interface AttackerAbility<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>
Parameters:
entry - target.

stopAttack

public void stopAttack()
Description copied from interface: AttackerAbility
Stop any action, reset all states.

Specified by:
stopAttack in interface AttackerAbility<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>

setAttackTimer

public void setAttackTimer(int time)
Description copied from interface: AttackerAbility
Set attack pause time between two attacks.

Specified by:
setAttackTimer in interface AttackerAbility<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>
Parameters:
time - attack pause time.

setAttackFrame

public void setAttackFrame(int frame)
Description copied from interface: AttackerAbility
Represent the frame number (inside animation) which design the attack action. Ex: for a footman, the frame number when the sword is going to hurt somebody (bewteen 1-last).

Specified by:
setAttackFrame in interface AttackerAbility<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>
Parameters:
frame - frame attack number.

setMinimalAttackDistance

public void setMinimalAttackDistance(int min)
Description copied from interface: AttackerAbility
Set minimum attack distance bewteen entry and target.

Specified by:
setMinimalAttackDistance in interface AttackerAbility<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>
Parameters:
min - minimum attack distance.

setMaximalAttackDistance

public void setMaximalAttackDistance(int max)
Description copied from interface: AttackerAbility
Set maximum attack distance bewteen entry and target.

Specified by:
setMaximalAttackDistance in interface AttackerAbility<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>
Parameters:
max - maximum attack distance.

isAttacking

public boolean isAttacking()
Description copied from interface: AttackerAbility
Check if entry is attacking.

Specified by:
isAttacking in interface AttackerAbility<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>
Returns:
true if currently attacking.