public class AttackerModel extends TraitModel implements Attacker
The ObjectGame
owner must have the following Trait
:
Constructor and Description |
---|
AttackerModel()
Create an attacker model.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(AttackerListener listener)
Add an attacker listener.
|
void |
attack(Transformable target)
Define a target to attack.
|
int |
getAttackDamages()
Get a random attack damages (between min and max).
|
Transformable |
getTarget()
Get the target entity.
|
boolean |
isAttacking()
Check weapon is attacking.
|
void |
prepare(ObjectGame owner,
Services services)
Prepare the trait.
|
void |
setAttackDamages(int min,
int max)
Set attack damages between entity and target.
|
void |
setAttackDistance(int min,
int max)
Set attack distance between entity and target.
|
void |
setAttackFrame(int frame)
Represents the frame number (inside animation) which design the attack action.
|
void |
setAttackTimer(int time)
Set attack pause time between two attacks.
|
void |
stopAttack()
Stop the current attack.
|
void |
update(double extrp) |
getOwner
public void prepare(ObjectGame owner, Services services)
Trait
prepare
in interface Trait
prepare
in class TraitModel
owner
- The owner reference.services
- The services reference.public void addListener(AttackerListener listener)
Attacker
addListener
in interface Attacker
listener
- The attacker listener to add.public void attack(Transformable target)
Attacker
public void stopAttack()
Attacker
stopAttack
in interface Attacker
public void setAttackTimer(int time)
Attacker
setAttackTimer
in interface Attacker
time
- The attack pause time.public void setAttackFrame(int frame)
Attacker
Example: for a footman, the frame number when the sword is going to hurt somebody (between 1-last).
setAttackFrame
in interface Attacker
frame
- The frame attack number.public void setAttackDistance(int min, int max)
Attacker
setAttackDistance
in interface Attacker
min
- The minimum attack distance (in tile).max
- The maximum attack distance (in tile).public void setAttackDamages(int min, int max)
Attacker
setAttackDamages
in interface Attacker
min
- The minimum attack damages.max
- The maximum attack damages.public int getAttackDamages()
Attacker
getAttackDamages
in interface Attacker
public boolean isAttacking()
Attacker
isAttacking
in interface Attacker
true
if currently attacking, false
else.public Transformable getTarget()
Attacker
Copyright © 2016 Byron 3D Games Studio. All rights reserved.