com.brackeen.javagamebook.ai
Class AIBot

java.lang.Object
  extended bycom.brackeen.javagamebook.game.GameObject
      extended bycom.brackeen.javagamebook.path.PathBot
          extended bycom.brackeen.javagamebook.ai.AIBot
Direct Known Subclasses:
EvolutionBot

public class AIBot
extends PathBot


Field Summary
static int BATTLE_STATE_ATTACK
           
static int BATTLE_STATE_DODGE
           
static int BATTLE_STATE_RUN_AWAY
           
static int DECESION_READY
           
static int NORMAL_STATE_CHASE
           
static int NORMAL_STATE_IDLE
           
static int NORMAL_STATE_PATROL
           
static int WOUNDED_STATE_DEAD
           
static int WOUNDED_STATE_HURT
           
 
Fields inherited from class com.brackeen.javagamebook.game.GameObject
STATE_ACTIVE, STATE_DESTROYED, STATE_IDLE
 
Constructor Summary
AIBot(PolygonGroup polygonGroup, CollisionDetection collisionDetection, Brain brain, PolygonGroup blastModel)
           
 
Method Summary
 void addHealth(float amount)
          Adds the specified amount to this bot's health.
 boolean canHear(GameObject object)
          Checks if this object can hear the specified object.
 boolean canSee(GameObject object)
          Checks if this object can see the specified object, (assuming this object has eyes in the back of its head).
 int chooseBattleState()
           
 void fireProjectile(Vector3D direction)
          Fires a projectile in the specified direction.
 int getAiState()
          Gets the AI state for this bot (different frm the GameObject state).
 float getHealth()
           
 float getMaxHealth()
           
 boolean isCriticalHealth()
          Returns true if the health is critically low (less than CRITICAL_HEALTH_PERCENT).
 boolean isFlying()
          Checks if this GameObject is currently flying.
 boolean isRegenerating()
          Returns true if this bot regenerates after it dies.
 void notifyEndOfPath()
           
 void notifyHitPlayer(long damage)
           
 void notifyWallCollision()
           
 void setPathFinder(PathFinder pathFinder)
          Sets the PathFinder class to use to follow the path.
 void setRegenerating(boolean isRegenerating)
          Sets whether this bot regenerates after it dies.
 void update(GameObject player, long elapsedTime)
          If this GameObject is in the active state, this method updates it's PolygonGroup.
 void updateHelper(GameObject player, long elapsedTime)
           
 
Methods inherited from class com.brackeen.javagamebook.path.PathBot
getFlyHeight, notifyObjectCollision, setFacing, setFlyHeight, setPathRecalcTime, setSpeed, setTurnSpeed
 
Methods inherited from class com.brackeen.javagamebook.game.GameObject
addListener, getBounds, getCeilHeight, getFloorHeight, getListener, getLocation, getName, getPolygonGroup, getSpawns, getTransform, getX, getY, getZ, isActive, isDestroyed, isIdle, isJumping, isMakingNoise, makeNoise, removeListener, sendTouchNotifications, setCeilHeight, setFloorHeight, setFlying, setJumping, setState
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NORMAL_STATE_IDLE

public static final int NORMAL_STATE_IDLE
See Also:
Constant Field Values

NORMAL_STATE_PATROL

public static final int NORMAL_STATE_PATROL
See Also:
Constant Field Values

NORMAL_STATE_CHASE

public static final int NORMAL_STATE_CHASE
See Also:
Constant Field Values

BATTLE_STATE_ATTACK

public static final int BATTLE_STATE_ATTACK
See Also:
Constant Field Values

BATTLE_STATE_DODGE

public static final int BATTLE_STATE_DODGE
See Also:
Constant Field Values

BATTLE_STATE_RUN_AWAY

public static final int BATTLE_STATE_RUN_AWAY
See Also:
Constant Field Values

WOUNDED_STATE_HURT

public static final int WOUNDED_STATE_HURT
See Also:
Constant Field Values

WOUNDED_STATE_DEAD

public static final int WOUNDED_STATE_DEAD
See Also:
Constant Field Values

DECESION_READY

public static final int DECESION_READY
See Also:
Constant Field Values
Constructor Detail

AIBot

public AIBot(PolygonGroup polygonGroup,
             CollisionDetection collisionDetection,
             Brain brain,
             PolygonGroup blastModel)
Method Detail

getHealth

public float getHealth()

getMaxHealth

public float getMaxHealth()

addHealth

public void addHealth(float amount)
Adds the specified amount to this bot's health. If the amount is less than zero, the bot's state is set to WOUNDED_STATE_HURT.


isCriticalHealth

public boolean isCriticalHealth()
Returns true if the health is critically low (less than CRITICAL_HEALTH_PERCENT).


getAiState

public int getAiState()
Gets the AI state for this bot (different frm the GameObject state).


isRegenerating

public boolean isRegenerating()
Returns true if this bot regenerates after it dies.


setRegenerating

public void setRegenerating(boolean isRegenerating)
Sets whether this bot regenerates after it dies.


setPathFinder

public void setPathFinder(PathFinder pathFinder)
Sets the PathFinder class to use to follow the path.

Overrides:
setPathFinder in class PathBot

update

public void update(GameObject player,
                   long elapsedTime)
Description copied from class: GameObject
If this GameObject is in the active state, this method updates it's PolygonGroup. Otherwise, this method does nothing.

Overrides:
update in class PathBot

updateHelper

public void updateHelper(GameObject player,
                         long elapsedTime)

fireProjectile

public void fireProjectile(Vector3D direction)
Fires a projectile in the specified direction. The direction vector should be normalized.


chooseBattleState

public int chooseBattleState()

canSee

public boolean canSee(GameObject object)
Checks if this object can see the specified object, (assuming this object has eyes in the back of its head).


canHear

public boolean canHear(GameObject object)
Checks if this object can hear the specified object. The specified object must be making a noise and be within hearing range of this object.


isFlying

public boolean isFlying()
Description copied from class: GameObject
Checks if this GameObject is currently flying. Flying objects should not has gravity applied to them.

Overrides:
isFlying in class PathBot

notifyEndOfPath

public void notifyEndOfPath()
Overrides:
notifyEndOfPath in class PathBot

notifyHitPlayer

public void notifyHitPlayer(long damage)

notifyWallCollision

public void notifyWallCollision()
Overrides:
notifyWallCollision in class PathBot