|
Pacman 3D .:. www.stormzone.de/uni/pacman3d/ | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--pacman3d.pacman.Pacman
This Class holds all the logic for the player character of our game. To be able to successfully use it, you should be sure, that the following points are met. First of all you should be certain, that a KeyControl Object exists, with the ID of this Pacman. Otherwise you would have a Pacman subject unable to move, 'cause it'll never receive a movement message. (One possible exception would be, that this Pacman is created as Shadow-Pacman. That is a Pacman, that is only created on other clients to mirror the moves of the master Pacman. In this case a KeyControl for the Masterpacman would exist, and since the shadow Pacmen have the same ID like the Masterpacman, they to would receive the movement messages).
As you see there are two kinds of Pacmen, that can be instantiated:
When instantiated you should get the ID of this Pacman and create a KeyControl for this one.
Copyright: Copyright (c) 2001
Constructor Summary | |
Pacman()
constructor initializing the PacMan. |
|
Pacman(ID oID,
Labyrinth oLabyrinth)
constructor initializing the PacMan. |
|
Pacman(ID oID,
Labyrinth oLabyrinth,
String sPacmanModel,
boolean isFriendly)
constructor initializing the PacMan. |
|
Pacman(Labyrinth oLabyrinth)
constructor initializing the PacMan. |
|
Pacman(Labyrinth oLabyrinth,
String sPacmanModel,
boolean isFriendly)
constructor initializing the PacMan. |
Method Summary | |
void |
enableFightAnimation(boolean bStartAnimation)
en- or disables the animation sequence that will allow the pacman to swing his katana. |
ID |
getID()
Gibt die eindeutige Bezeichnung eines Objektes in Form einer Instanz der Klasse ID zurück. |
Node |
getJ3DNode()
returns Java3D Node containing PacMan this function should be called only once right after creaing PacMan |
Vector3d |
getLineOfSight()
returns line of sight |
void |
getMessage(Message oMessage)
adds Message to the Message queue |
static Vector |
getModelList()
get vector of all available models |
TransformGroup |
getModelPreview(String sPacmanModel)
this function will create a model and return it for the intro |
Point3i |
getPacmanPos()
returns the current position of this pacman |
Object |
getParameter(String sParametername)
returns any parameter |
int |
getParameterCount()
returns number of parameters available for the pacman |
String |
getParameterDescription(int nPos)
this function returns the description for the given parameter |
String |
getParameterName(int nPosition)
returns name of parameter at the given position |
Object |
getParameterType(int nPosition)
returns the type of the parameter at the given position |
Vector3d |
getRealLineOfSight()
returns line of sight |
Point3d |
getRealPacmanPos()
returns the real position of this pacman |
boolean |
isInvincible()
get invincibility status |
void |
loadFromDOM(Element oElement)
right now this code won't do anything good ... later it will be possible to initialize PacMan with parameters given in XML format |
void |
makeLoop(int nTicks)
This is the main function for all operations regarding this pacman. |
void |
movePacman(Point3d oPoint)
explicitly sets the position should be called after initalizing pacman |
Element |
saveToDOM(Document oDoc)
not yet implemented |
void |
sendInventoryMessage()
sends the current inventory state to the inventory-panel |
void |
sendScoreMessage()
sends the current score to the score-panel |
void |
setDemoMode(boolean bIsDemoMode)
with this method it is possible to influence the mode with which messages are handled. |
void |
setLineOfSight(Vector3d oCurrentLineOfSight)
sets line of sight should be called initially |
void |
setMovementCost(int nCost)
this method will set the number of ticks needed to complete a Movement operation |
void |
setPacmanPos(int nX,
int nY,
int nZ)
explicitly sets the position should be called after initalizing pacman |
void |
setPacmanPos(Point3i oPoint)
explicitly sets the position should be called after initalizing pacman |
void |
setParameter(String sParametername,
Object oParametervalue)
this function allows to set any parameter available to the pacman |
void |
setRotationCost(int nCost)
this method will set the number of ticks needed to complete a Rotate operation |
void |
setVisible(boolean bIsVisible)
updates the visibility status of PacMan |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Pacman()
public Pacman(Labyrinth oLabyrinth)
oLabyrinth
- the labyrinth the pacman is moving inpublic Pacman(ID oID, Labyrinth oLabyrinth)
oID
- the ID, that the Pacman shall receiveoLabyrinth
- the labyrinth the pacman is moving inpublic Pacman(Labyrinth oLabyrinth, String sPacmanModel, boolean isFriendly)
oLabyrinth
- the labyrinth the pacman is moving insPacmanModel
- the string of the model to be loaded the String should
be one of the Strings from getModelList.isFriendly
- if true this pacman doesn't attack other pacman
otherwise he'll treat them like he would treat monsters :)public Pacman(ID oID, Labyrinth oLabyrinth, String sPacmanModel, boolean isFriendly)
oID
- the ID, that the Pacman shall receiveoLabyrinth
- the labyrinth the pacman is moving insPacmanModel
- the string of the model to be loaded the String should
be one of the Strings from getModelList.isFriendly
- if true this pacman doesn't attack other pacman
otherwise he'll treat them like he would treat monsters :)Method Detail |
public void getMessage(Message oMessage)
getMessage
in interface MessageListener
oMessage
- the message to be addedpublic void makeLoop(int nTicks)
This is the main function for all operations regarding this pacman. It operates as follows. First will be decided whether an operation is in progress or not.
nTicks
- the number of ticks available for operationspublic void setVisible(boolean bIsVisible)
bIsVisible
- if true pacman is visible otherwise notpublic Node getJ3DNode()
public void setPacmanPos(Point3i oPoint)
oPoint
- the position where pacman will spawnpublic void movePacman(Point3d oPoint)
oPoint
- the position, pacman will move topublic void setPacmanPos(int nX, int nY, int nZ)
nX
- the x position of Pacman in the labyrinthnY
- the y position of Pacman in the labyrinthnZ
- the z position of Pacman in the labyrinthpublic Point3i getPacmanPos()
public Point3d getRealPacmanPos()
public Vector3d getLineOfSight()
public Vector3d getRealLineOfSight()
public void setLineOfSight(Vector3d oCurrentLineOfSight)
oCurrentLineOfSight
- the line of sight to be setpublic boolean isInvincible()
public ID getID()
Identifiable
ID
zurück.
getID
in interface Identifiable
public TransformGroup getModelPreview(String sPacmanModel)
sPacmanModel
- model to be shownpublic static Vector getModelList()
public void loadFromDOM(Element oElement)
right now this code won't do anything good ... later it will be possible to initialize PacMan with parameters given in XML format
loadFromDOM
in interface XMLSerializeable
oElement
- xml-element containing initparameterspublic Element saveToDOM(Document oDoc)
not yet implemented
saveToDOM
in interface XMLSerializeable
oDoc
- the document to be saved topublic void setParameter(String sParametername, Object oParametervalue)
setParameter
in interface Introspectable
sParametername
- the parameter to be setoParametervalue
- the value to be setpublic Object getParameter(String sParametername)
getParameter
in interface Introspectable
sParametername
- the parameter to be returnedpublic int getParameterCount()
getParameterCount
in interface Introspectable
public String getParameterName(int nPosition)
getParameterName
in interface Introspectable
nPosition
- the position of the parameterpublic Object getParameterType(int nPosition)
getParameterType
in interface Introspectable
nPosition
- the position of the parameterpublic void setMovementCost(int nCost)
nCost
- the new cost of a movement operationpublic void setRotationCost(int nCost)
nCost
- the new cost of a rotation operationpublic String getParameterDescription(int nPos)
getParameterDescription
in interface Introspectable
nPos
- the position of the parameterpublic void sendScoreMessage()
public void sendInventoryMessage()
public void enableFightAnimation(boolean bStartAnimation)
bStartAnimation
- if true animation sequence is started
if false sequence is stoppedpublic void setDemoMode(boolean bIsDemoMode)
bIsDemoMode
- if true all incoming messages are accepted,
if false only new messages are accepted
|
Pacman 3D .:. www.stormzone.de/uni/pacman3d/ | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |