public class NPC extends AbstractPerson
AbstractPerson.Direction, AbstractPerson.Personality, AbstractPerson.PersonPositionComparator, AbstractPerson.PersonState| Modifier and Type | Field and Description |
|---|---|
java.util.List<Clue> |
associatedClues
Associated clues
|
private boolean |
canBeKiller
These two booleans decide whether an NPC has the potential to be a killer and if, in this particular game, they
are the killer.
|
private boolean |
hasBeenAccused
This indicates whether the NPC has been accused.
|
private boolean |
isKiller |
private boolean |
isVictim |
private java.lang.String |
motive
The motive string details why the NPC committed the murder.
|
private AbstractPerson.Personality |
personality
This stores the players personality
AbstractPerson.Personality |
private java.util.Random |
random |
animTime, animTimer, canMove, coordinates, currentRegion, destinationTile, direction, jsonData, SPRITE_HEIGHT, SPRITE_WIDTH, spriteSheet, startTile, state, tileCoordinates| Constructor and Description |
|---|
NPC(java.lang.String name,
java.lang.String spriteSheet,
int tileX,
int tileY,
Room room,
boolean canBeKiller,
java.lang.String jsonFile)
Define an NPC with location coordinates , room, spritesheet and whether or not they can be the killer
|
| Modifier and Type | Method and Description |
|---|---|
void |
accuse()
Sets the accuse state of the NPC.
|
boolean |
canBeKiller()
Getter for canBeKiller
|
java.lang.String |
getMotive()
Getter for motive.
|
AbstractPerson.Personality |
getPersonality()
This method returns the NPCs personality
|
java.lang.String |
getSpeech(Clue clue,
AbstractPerson.Personality style)
This handles speech for a clue that has a question style
|
void |
importDialogue(java.lang.String fileName)
Reads in the JSON file of tha character and stores dialogue in the dialogue HashMap
|
boolean |
isAccused()
Get whether the NPC has been accused.
|
boolean |
isKiller()
Getter for isKiller.
|
boolean |
isVictim()
Getter for isVictim
|
void |
move(AbstractPerson.Direction dir)
Allow the NPC to move around their room.
|
private void |
randomMove()
This method attempts to move the NPC in a random direction
|
boolean |
setKiller()
This method sets the NPC as the killer for this game.
|
NPC |
setMotive(java.lang.String motive)
Setter for the NPC's motive string.
|
boolean |
setVictim()
This method sets the NPC to be the victim for the game
|
void |
update()
This method is called once a game tick to randomise movement.
|
finishMove, getDirection, getName, getRoom, getSpeech, getSpeech, getState, getTileCoordinates, initialiseMove, pushCoordinatesToSprite, setAnimTime, setDirection, setRoom, setTileCoordinates, updateTextureRegiondraw, draw, flip, getBoundingRectangle, getColor, getHeight, getOriginX, getOriginY, getRotation, getScaleX, getScaleY, getVertices, getWidth, getX, getY, rotate, rotate90, scale, scroll, set, setAlpha, setBounds, setCenter, setCenterX, setCenterY, setColor, setColor, setColor, setFlip, setOrigin, setOriginCenter, setPosition, setRegion, setRotation, setScale, setScale, setSize, setU, setU2, setV, setV2, setX, setY, translate, translateX, translateYgetRegionHeight, getRegionWidth, getRegionX, getRegionY, getTexture, getU, getU2, getV, getV2, isFlipX, isFlipY, setRegion, setRegion, setRegion, setRegion, setRegionHeight, setRegionWidth, setRegionX, setRegionY, setTexture, split, splitpublic java.util.List<Clue> associatedClues
private java.util.Random random
private java.lang.String motive
private boolean canBeKiller
private boolean isKiller
private boolean isVictim
private boolean hasBeenAccused
private AbstractPerson.Personality personality
AbstractPerson.Personalitypublic NPC(java.lang.String name,
java.lang.String spriteSheet,
int tileX,
int tileY,
Room room,
boolean canBeKiller,
java.lang.String jsonFile)
tileX - - x coordinate of tile that the NPC will be initially rendered on.tileY - - y coordinate of tile that the NPC will be initially rendered on.room - - ID of room they are inspriteSheet - - Spritesheet for this NPCcanBeKiller - - Boolean whether they can or cannot be the killerpublic void update()
update in class AbstractPersonpublic void importDialogue(java.lang.String fileName)
importDialogue in class AbstractPersonfileName - - The filename to read frompublic void move(AbstractPerson.Direction dir)
dir - the direction person should move inprivate void randomMove()
public boolean canBeKiller()
canBeKillerpublic boolean isKiller()
isKillerpublic boolean isVictim()
isVictimpublic java.lang.String getMotive()
motivepublic NPC setMotive(java.lang.String motive)
motive - - The motive this particular NPC has for committing the murder.public boolean setKiller()
It first checks they aren't the victim and if they can be the killer
public boolean setVictim()
It first checks if the NPC isn't also the killer
public java.lang.String getSpeech(Clue clue, AbstractPerson.Personality style)
getSpeech in class AbstractPersonclue - the clue to be questioned aboutstyle - the style of questioningpublic AbstractPerson.Personality getPersonality()
getPersonality in class AbstractPersonAbstractPerson.Personalitypublic void accuse()
public boolean isAccused()