|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.lib.properties.SimpleLightSource wyvern.lib.properties.MovableLightSource
This property makes an object glow in the dark.
You can add one to any GameObject to turn it into a glowing object. The MovableLightSource will follow the target object around, moving the light with the object.
Wyvern's laws of physics are such that:
So the MovableLightSource has to track not only the target object, but anyone carrying the target, and anyone carrying the carrier, and so on. So it automatically supports, for example, a wizard carrying a pirate with a parrot on his shoulder with a torch in its mouth. The wizard will glow, and the light follows the wizard. If the parrot puts the torch in a bag, the light shuts off.
Field Summary |
Fields inherited from class wyvern.lib.properties.SimpleLightSource |
caster_, DEFAULT_LIGHT_SOURCE_INTENSITY, intensity_, localIntensity_, location_, map_, matrix_ |
Fields inherited from interface wyvern.lib.properties.LightingConstants |
DARKNESS, DAYLIGHT, DIM, DUSK, GLOOM, NUM_SHADES, SHADED, TWILIGHT |
Constructor Summary | |
MovableLightSource()
Constructs a new MovableLightSource |
|
MovableLightSource(int intensity)
Constructs a new MovableLightSource with the specified intensity. |
Method Summary | |
protected void |
addToChain(GameObject obj)
Starts tracking someone who picked up the top object in our tracking chain. |
protected void |
createChain()
Creates the list for holding a carrier (or chain of carriers). |
java.lang.Object |
createClone()
Clones the property so that instances get their own copy. |
protected GameObject |
getBaseObject()
Returns the first object in the chain, e.g. the glowstones, or fire elemental, or lighting bolt spell piece, which contains this MovableLightSource in its property list. |
protected GameObject |
getCarrier(GameObject obj)
Returns the carrier of a given object. |
protected GameObject |
getHeadObject()
Returns the top (outermost) object in the chain. |
protected boolean |
isBeingCarried(GameObject obj)
Returns true if the passed GameObject is currently in someone's inventory. |
void |
notifyAdd(PropertyList list)
We've been added to a target object's property list. |
void |
notifyRemove(PropertyList list)
Notifies the property that it's being removed from some GameObject's property-list. |
protected java.lang.String |
printChain()
Returns a printout of the objects in the chain, from first (base) to last (head/top/outermost). |
void |
propertyChange(java.beans.PropertyChangeEvent event)
Map lighting model turned on or off. |
void |
readData(org.w3c.dom.Node bean)
We don't do anything. |
protected void |
removeFromChain(GameObject obj)
Removes an object from the tracking chain, along with all of its parents going up the chain. |
boolean |
shouldWrite()
Don't write the object out. |
protected void |
startTracking(GameObject obj)
Adds motion and container listeners to the passed object. |
protected void |
stopTracking(GameObject obj)
Removes motion/container listeners from the passed object. |
void |
targetEnteredContainer(ContainerChangeEvent event)
An object we're tracking was added to a container. |
void |
targetEnteredMap(MapChangeEvent event)
An object we're tracking entered a new map. |
void |
targetLeftContainer(ContainerChangeEvent event)
A tracked object was removed from a container. |
void |
targetLeftMap(MapChangeEvent event)
Notification that the target object has left its map. |
void |
targetMoved(MapMotionEvent event)
Target object moved or teleported in its map. |
java.lang.String |
toString()
Prints String representation. |
java.util.List |
writeData()
Don't write anything out. |
Methods inherited from class wyvern.lib.properties.SimpleLightSource |
computeLocalIntensity, computeMatrix, getAlphaForLightLevel, getDistance, getIntensity, getLightMatrix, getLocation, getMap, getMatrixLocation, getShadingTile, main, recompute, remove, setIntensity, setLocation, setMap, setMap |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public MovableLightSource()
public MovableLightSource(int intensity)
intensity
- the intensity (radius) for the light sourceMethod Detail |
public void notifyAdd(PropertyList list)
notifyAdd
in interface AddRemoveNotify
list
- the GameObject whose property list we're being added topublic void notifyRemove(PropertyList list)
notifyRemove
in interface AddRemoveNotify
list
- the GameObject whose property list we're being
removed frompublic void targetEnteredContainer(ContainerChangeEvent event)
targetEnteredContainer
in interface ContainerChangeListener
public void targetLeftContainer(ContainerChangeEvent event)
targetLeftContainer
in interface ContainerChangeListener
public void targetEnteredMap(MapChangeEvent event)
targetEnteredMap
in interface MapChangeListener
public void targetLeftMap(MapChangeEvent event)
targetLeftMap
in interface MapChangeListener
public void targetMoved(MapMotionEvent event)
targetMoved
in interface MapMotionListener
protected void startTracking(GameObject obj)
protected void stopTracking(GameObject obj)
protected void createChain()
protected void addToChain(GameObject obj)
protected void removeFromChain(GameObject obj)
protected boolean isBeingCarried(GameObject obj)
protected GameObject getCarrier(GameObject obj)
protected GameObject getHeadObject()
protected GameObject getBaseObject()
public void propertyChange(java.beans.PropertyChangeEvent event)
propertyChange
in interface java.beans.PropertyChangeListener
public void readData(org.w3c.dom.Node bean) throws java.lang.Exception
readData
in interface SelfExternalizable
bean
- the XML DOM representation of the externalized
bean object. Its child could be a text node, in which case
the bean has to do all the parsing for the data. It could
also wrap a series of elements (e.g. archetypes), in which case
the bean may wish to leverage the XML parsing utilities that
the game provides in the ArchetypeManager.
java.lang.Exception
public java.util.List writeData() throws java.lang.Exception
writeData
in interface SelfExternalizable
java.lang.Exception
public boolean shouldWrite()
shouldWrite
in interface SelfExternalizable
public java.lang.Object createClone()
createClone
in interface MutableProperty
public java.lang.String toString()
toString
in class SimpleLightSource
protected java.lang.String printChain()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |