public class NPCharacter extends AICharacter implements Serializable
AICharacter that supports
Non-Player Characters. As a simple approximation, NPCs are characters
that wander around dungeons, and when hit, say one of a series of
phrases.| Constructor and Description |
|---|
NPCharacter(int id,
String name,
String[] messages,
AICharacterManager mgr)
Creates an instance of
NPCharacter. |
| Modifier and Type | Method and Description |
|---|---|
LevelBoard.ActionResult |
collidedFrom(Character character)
Called when the given character collides with us.
|
boolean |
collidedInto(Character character)
Called when you collide with the character.
|
CharacterStats |
getStatistics()
Returns the statistics associated with this character.
|
void |
notifyStatsChanged()
This method tells the character that their stats have changed.
|
void |
regenerate()
This has no affect on
NPCharacter since NPCs have no
meaningful statistics. |
void |
run()
Called periodically to give this character a chance to walk around
the level.
|
void |
sendMessage(String message)
Sends a text message to the character's manager.
|
getID, getNamepublic NPCharacter(int id,
String name,
String[] messages,
AICharacterManager mgr)
NPCharacter.id - the identifier for this NPCname - the name for this NPCmessages - the set of messages that this NPC says when hitmgr - the controlling managerpublic CharacterStats getStatistics()
getStatistics in interface Characterpublic void notifyStatsChanged()
notifyStatsChanged in interface Characterpublic LevelBoard.ActionResult collidedFrom(Character character)
FAIL
since we never yield our positioncollidedFrom in interface Charactercharacter - the character that collided with usActionResult.FAILpublic boolean collidedInto(Character character)
collidedInto in interface Charactercharacter - the character that we collided withfalsepublic void sendMessage(String message)
sendMessage in interface Charactermessage - the message to sendpublic void run()
run in class AICharacterpublic void regenerate()
NPCharacter since NPCs have no
meaningful statistics.regenerate in class AICharacterCopyright © 2013. All Rights Reserved.