E
- The entity type used.A
- The attacker type used.public abstract class WeaponModel<E extends EntityStrategy,A extends AttackerUsedServices<E>> extends ObjectGame implements WeaponServices<E,A>, AttackerListener<E>
Constructor and Description |
---|
WeaponModel(SetupGame setup)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
attack(E target)
Define a target to attack.
|
int |
getAttackDamages()
Get a random attack damages (between min and max).
|
int |
getHeight() |
int |
getLocationIntX() |
int |
getLocationIntY() |
E |
getTarget()
Get the target entity.
|
A |
getUser()
Get the weapon user.
|
int |
getWidth() |
boolean |
isAttacking()
Check weapon is attacking.
|
void |
notifyAttackAnimEnded()
Notify when attacker has played his attack completely.
|
void |
notifyAttackEnded(int damages,
E target)
Notify when attacker has done his attack.
|
void |
notifyAttackStarted(E target)
Notify when attacker is going to attack.
|
void |
notifyPreparingAttack()
Notify while attacker is waiting for next attack.
|
void |
notifyReachingTarget(E target)
Notify while attacker is reaching target.
|
void |
notifyTargetLost(E target)
Notify when attacker lost its target.
|
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 |
setUser(A user)
Set the weapon user.
|
void |
stopAttack()
Stop the current attack.
|
void |
updateAttack(double extrp)
Update attack routine.
|
destroy, getDataAnimation, getDataBoolean, getDataCollision, getDataDouble, getDataInteger, getDataRoot, getDataString, getId, isDestroyed, loadData
public WeaponModel(SetupGame setup)
setup
- The setup reference.public void attack(E target)
WeaponServices
attack
in interface WeaponServices<E extends EntityStrategy,A extends AttackerUsedServices<E>>
target
- The target to attack.public void stopAttack()
WeaponServices
stopAttack
in interface WeaponServices<E extends EntityStrategy,A extends AttackerUsedServices<E>>
public void updateAttack(double extrp)
WeaponServices
updateAttack
in interface WeaponServices<E extends EntityStrategy,A extends AttackerUsedServices<E>>
extrp
- The extrapolation value.public void setUser(A user)
WeaponServices
setUser
in interface WeaponServices<E extends EntityStrategy,A extends AttackerUsedServices<E>>
user
- The weapon user.public void setAttackTimer(int time)
WeaponServices
setAttackTimer
in interface WeaponServices<E extends EntityStrategy,A extends AttackerUsedServices<E>>
time
- The attack pause time.public void setAttackFrame(int frame)
WeaponServices
Example: for a footman, the frame number when the sword is going to hurt somebody (between 1-last).
setAttackFrame
in interface WeaponServices<E extends EntityStrategy,A extends AttackerUsedServices<E>>
frame
- The frame attack number.public void setAttackDistance(int min, int max)
WeaponServices
setAttackDistance
in interface WeaponServices<E extends EntityStrategy,A extends AttackerUsedServices<E>>
min
- The minimum attack distance (in tile).max
- The maximum attack distance (in tile).public void setAttackDamages(int min, int max)
WeaponServices
setAttackDamages
in interface WeaponServices<E extends EntityStrategy,A extends AttackerUsedServices<E>>
min
- The minimum attack damages.max
- The maximum attack damages.public int getAttackDamages()
WeaponServices
getAttackDamages
in interface WeaponServices<E extends EntityStrategy,A extends AttackerUsedServices<E>>
public boolean isAttacking()
WeaponServices
isAttacking
in interface WeaponServices<E extends EntityStrategy,A extends AttackerUsedServices<E>>
true
if currently attacking, false
else.public A getUser()
WeaponServices
getUser
in interface WeaponServices<E extends EntityStrategy,A extends AttackerUsedServices<E>>
public E getTarget()
WeaponServices
getTarget
in interface WeaponServices<E extends EntityStrategy,A extends AttackerUsedServices<E>>
public int getLocationIntX()
getLocationIntX
in interface Surface
public int getLocationIntY()
getLocationIntY
in interface Surface
public void notifyReachingTarget(E target)
AttackerListener
notifyReachingTarget
in interface AttackerListener<E extends EntityStrategy>
target
- The target to reach.public void notifyAttackStarted(E target)
AttackerListener
notifyAttackStarted
in interface AttackerListener<E extends EntityStrategy>
target
- The target reference.public void notifyAttackAnimEnded()
AttackerListener
notifyAttackAnimEnded
in interface AttackerListener<E extends EntityStrategy>
public void notifyAttackEnded(int damages, E target)
AttackerListener
notifyAttackEnded
in interface AttackerListener<E extends EntityStrategy>
damages
- The final damages.target
- The target reference.public void notifyPreparingAttack()
AttackerListener
notifyPreparingAttack
in interface AttackerListener<E extends EntityStrategy>
public void notifyTargetLost(E target)
AttackerListener
notifyTargetLost
in interface AttackerListener<E extends EntityStrategy>
target
- The target lost.Copyright © 2014 Byron 3D Games Studio. All rights reserved.