org.jadv.basic
Class Level

java.lang.Object
  |
  +--org.jadv.basic.SavedObject
        |
        +--org.jadv.basic.JAdvObject
              |
              +--org.jadv.basic.Level
All Implemented Interfaces:
java.io.Serializable

public class Level
extends JAdvObject

This is a basic Level in the game.

Author:
neitzel
See Also:
Serialized Form

Field Summary
private  int _build
           
(package private)  java.util.HashMap _objects
           
 
Fields inherited from class org.jadv.basic.JAdvObject
_children, _description, _HeartBeatTime, _Size
 
Fields inherited from class org.jadv.basic.SavedObject
ObjMan
 
Constructor Summary
Level()
          Constructor
Level(org.jdom.Element descel)
           
 
Method Summary
 void addChild(JAdvObject obj)
          Add a child-Object inside this object
static boolean canSee(Level_StoredObject obj1, Level_StoredObject obj2)
          Check if one object can see the second object
static boolean checkSight(int dx, int dy, int sight, int size)
          check, if one object can see the other object
 boolean getAutoStart()
          Levels must be loaded at startup: We always return true!
 int getBuild()
          get the build number
 void init(java.util.HashMap attribs)
          initialize the object
 void objectChanged(JAdvObject obj)
          An object changed it's description.
 void objectMoveIn(JAdvObject obj)
          An object moved inside this Level.
 void objectMoveInside(JAdvObject obj)
          An object inside this Level moved from one Location to another.
 void objectMoveOut(JAdvObject obj)
          An object moved out of this Level.
 void save()
          Saving the object.
 void say(java.lang.String objID, java.lang.String msg)
          Somebody in the level wants to say something
 void sendMessageEvent(Level_StoredObject target, java.lang.String sender, java.lang.String msg, byte type)
          Sends an MessageEvent to the target
 void sendObjectNoLongerSeenEvent(Level_StoredObject obj1, Level_StoredObject obj2)
          Send an ObjectNoLongerSeenEvent to obj1, that obj2 is no longer seen
 void sendSeeObjectEvent(Level_StoredObject obj1, Level_StoredObject obj2)
          Send an SeenObjectEvent to obj1, that obj2 is seen
 void shout(java.lang.String objID, java.lang.String msg)
          Somebody in the level wants to shout!
 
Methods inherited from class org.jadv.basic.JAdvObject
canMoveIn, canMoveOut, create, destroyObject, disableHeartBeat, enableHeartBeat, getDescription, getMasterParentID, getOldParentID, getParentID, getSight, getSize, HeartBeat, removeChild, reset, sendPlayerEvent, setDescription, setMasterParentID_DEEP, setMasterParentID, setOldParentID, setParentID, setSize, setTimer, timer
 
Methods inherited from class org.jadv.basic.SavedObject
addEvent, canBeSwapped, createAttributes, createObject, createObject, createUUID, findObject, getAttribute, getAttributes, getDeveloper, getId, getIntAttribute, getIntAttribute, getName, getNext, getPrev, hexFormat, isChanged, isValid, loadObject, markChanged, markNotChanged, mergeAttributes, removeFromList, replaceObject, replaceObject, saveObject, setAttribute, setId, setIntAttribute, setName, storeAfter, swapOut
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_build

private int _build

_objects

java.util.HashMap _objects
Constructor Detail

Level

public Level()
Constructor


Level

public Level(org.jdom.Element descel)
Method Detail

addChild

public void addChild(JAdvObject obj)
Add a child-Object inside this object

Overrides:
addChild in class JAdvObject
Parameters:
obj -

canSee

public static boolean canSee(Level_StoredObject obj1,
                             Level_StoredObject obj2)
Check if one object can see the second object

Parameters:
obj1 - - first object
obj2 - - second object
Returns:
true if obj1 can see obj2

checkSight

public static boolean checkSight(int dx,
                                 int dy,
                                 int sight,
                                 int size)
check, if one object can see the other object

Parameters:
dx - distanze x-value
dy - distance y-value
sight - sight of the main object
size - size of the target
Returns:
true if object is seen else false

getBuild

public int getBuild()
get the build number

Returns:
int - the build number

init

public void init(java.util.HashMap attribs)
initialize the object

Overrides:
init in class JAdvObject
Parameters:
attribs - - the attributes of the object

objectChanged

public void objectChanged(JAdvObject obj)
An object changed it's description. This must be sent to all other objects, that can see this object.

Parameters:
obj - - the changed object.

objectMoveIn

public void objectMoveIn(JAdvObject obj)
An object moved inside this Level. Now all livings get their Events!

Parameters:
obj - the object, that moved inside the Level

objectMoveInside

public void objectMoveInside(JAdvObject obj)
An object inside this Level moved from one Location to another. Now all livings get their Events!

Parameters:
obj - the object, that moved around

objectMoveOut

public void objectMoveOut(JAdvObject obj)
An object moved out of this Level. Now all livings get their Events!

Parameters:
obj - the object, that moved out of the Level

save

public void save()
Saving the object.

Overrides:
save in class JAdvObject

say

public void say(java.lang.String objID,
                java.lang.String msg)
Somebody in the level wants to say something

Parameters:
objID - - Object, that wants to say something!
msg - - Message

sendMessageEvent

public void sendMessageEvent(Level_StoredObject target,
                             java.lang.String sender,
                             java.lang.String msg,
                             byte type)
Sends an MessageEvent to the target

Parameters:
target - - target for the message
sender - - sender of the message
msg - - message
type - - type of message

sendSeeObjectEvent

public void sendSeeObjectEvent(Level_StoredObject obj1,
                               Level_StoredObject obj2)
Send an SeenObjectEvent to obj1, that obj2 is seen

Parameters:
obj1 - - target of the message
obj2 - - Object, that is seen

sendObjectNoLongerSeenEvent

public void sendObjectNoLongerSeenEvent(Level_StoredObject obj1,
                                        Level_StoredObject obj2)
Send an ObjectNoLongerSeenEvent to obj1, that obj2 is no longer seen

Parameters:
obj1 - - target of the message
obj2 - - Object, that is no longer seen

shout

public void shout(java.lang.String objID,
                  java.lang.String msg)
Somebody in the level wants to shout!

Parameters:
objID - - Object, that wants to shout
msg - - Message

getAutoStart

public boolean getAutoStart()
Levels must be loaded at startup: We always return true!

Overrides:
getAutoStart in class SavedObject
Returns:
boolean - true if the Object should be loaded
See Also:
SavedObject.getAutoStart()