wyvern.lib.properties
Class TerrainSpeed

java.lang.Object
  extended bywyvern.lib.properties.TerrainSpeed
All Implemented Interfaces:
AddRemoveNotify, java.util.EventListener, MapChangeListener, MapLifecycleListener, MutableProperty

public class TerrainSpeed
extends java.lang.Object
implements AddRemoveNotify, MapChangeListener, MapLifecycleListener, MutableProperty

Sets the terrain speed of the terrain under this object. Necessary for bridges, piers, and other objects that let you move at a speed different from the normal terrain speed.

This property will only work properly for immobile, 1x1 objects.

Version:
1.0, Feb 26, 2003
Author:
Steve Yegge

Constructor Summary
TerrainSpeed()
           
 
Method Summary
 void clearTerrainSpeed()
          Puts the old terrain speed back.
 java.lang.Object createClone()
          Makes a clone of this object.
 void fixSpeed()
          Sets the terrain speed (by cloning a new terrain, sometimes), and adds "can-walk" to the target object if appropriate.
 int getSpeed()
          Returns the speed to use for the terrain beneath our target obj.
 void mapLoaded(MapLifecycleEvent event)
          Invoked when a map is loaded.
 void mapResumed(MapLifecycleEvent event)
          Invoked when a map is resumed.
 void mapSuspended(MapLifecycleEvent event)
          Invoked when a map is suspended.
 void mapUnloaded(MapLifecycleEvent event)
          Invoked when a map is unloaded.
static void markCanWalk(GameObject target)
           
 void notifyAdd(PropertyList list)
          Notifies the property that it's being added.
 void notifyRemove(PropertyList list)
          Notifies the property that it's being removed.
 void setSpeed(int speed)
          Sets the speed to use for the terrain beneath our target obj.
 void setTerrainSpeed()
          Replaces the terrain beneath us with some faster terrain.
 void targetEnteredMap(MapChangeEvent event)
          Notification that the target object has entered a map.
 void targetLeftMap(MapChangeEvent event)
          Notification that the target object has left its map.
 java.lang.String toString()
          Prints debugging string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TerrainSpeed

public TerrainSpeed()
Method Detail

notifyAdd

public void notifyAdd(PropertyList list)
Notifies the property that it's being added.

Specified by:
notifyAdd in interface AddRemoveNotify
Parameters:
list - the GameObject whose property list we're being added to

notifyRemove

public void notifyRemove(PropertyList list)
Notifies the property that it's being removed.

Specified by:
notifyRemove in interface AddRemoveNotify
Parameters:
list - the GameObject whose property list we're being removed from

targetEnteredMap

public void targetEnteredMap(MapChangeEvent event)
Notification that the target object has entered a map. Called at the end of the object's setMap() function.

Specified by:
targetEnteredMap in interface MapChangeListener

targetLeftMap

public void targetLeftMap(MapChangeEvent event)
Notification that the target object has left its map. Called at the end of the object's remove() function.

Specified by:
targetLeftMap in interface MapChangeListener

mapLoaded

public void mapLoaded(MapLifecycleEvent event)
Invoked when a map is loaded.

Specified by:
mapLoaded in interface MapLifecycleListener

mapUnloaded

public void mapUnloaded(MapLifecycleEvent event)
Description copied from interface: MapLifecycleListener
Invoked when a map is unloaded.

Specified by:
mapUnloaded in interface MapLifecycleListener

mapSuspended

public void mapSuspended(MapLifecycleEvent event)
Description copied from interface: MapLifecycleListener
Invoked when a map is suspended.

Specified by:
mapSuspended in interface MapLifecycleListener

mapResumed

public void mapResumed(MapLifecycleEvent event)
Description copied from interface: MapLifecycleListener
Invoked when a map is resumed.

Specified by:
mapResumed in interface MapLifecycleListener

setSpeed

public void setSpeed(int speed)
Sets the speed to use for the terrain beneath our target obj. Called reflectively by JavaBeans stuff.


getSpeed

public int getSpeed()
Returns the speed to use for the terrain beneath our target obj. Called reflectively by the JavaBeans stuff.


fixSpeed

public void fixSpeed()
Sets the terrain speed (by cloning a new terrain, sometimes), and adds "can-walk" to the target object if appropriate. Called in the "done-loading" method hook for the target's map.


markCanWalk

public static void markCanWalk(GameObject target)

setTerrainSpeed

public void setTerrainSpeed()
Replaces the terrain beneath us with some faster terrain.


clearTerrainSpeed

public void clearTerrainSpeed()
Puts the old terrain speed back.


toString

public java.lang.String toString()
Prints debugging string.


createClone

public java.lang.Object createClone()
Makes a clone of this object.

Specified by:
createClone in interface MutableProperty