java.lang.Object com.realtime.crossfire.jxclient.map.AnimationState
public class AnimationState
The state of an Animation
on a map.
Field Summary | |
---|---|
private Animation |
animation
The Animation to display. |
private int |
index
The face index currently shown. |
private int |
lastFace
Records the last known face. |
private java.util.Set<Location> |
locations
All map locations this animation is displayed at. |
private CfMapUpdater |
mapUpdater
The CfMapUpdater instance to use. |
private int |
speed
The animation speed. |
private int |
tickNo
The face was updated last in this tick number. |
Constructor Summary | |
---|---|
AnimationState(CfMapUpdater mapUpdater,
Animation animation,
int index)
Creates a new instance. |
Method Summary | |
---|---|
void |
allocate(Location location)
Adds this animation state to a map Location . |
void |
free(Location location)
Removes this animation state from a map Location . |
java.util.Iterator<Location> |
iterator()
|
void |
scroll(int dx,
int dy,
int width,
int height)
Scrolls all map locations. |
void |
setSpeed(int speed)
Sets the animation speed. |
void |
setTickNo(int tickNo)
Sets the tick number. |
private void |
updateFace()
Updates the map face from the state. |
void |
updateTickNo(int tickNo)
Sets the tick number and update affected faces. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@NotNull private final Animation animation
Animation
to display.
private int index
speed
*animation
.getFaces() (exclusive).
private int lastFace
@NotNull private final java.util.Set<Location> locations
locations
this animation is displayed at.
@NotNull private final CfMapUpdater mapUpdater
CfMapUpdater
instance to use.
private int speed
private int tickNo
Constructor Detail |
---|
public AnimationState(@NotNull CfMapUpdater mapUpdater, @NotNull Animation animation, int index)
mapUpdater
- the map updater instance to useanimation
- the animation to displayindex
- the initial face indexMethod Detail |
---|
public void allocate(@NotNull Location location)
Location
.
location
- the map locationpublic void free(@NotNull Location location)
Location
.
location
- the location to free@NotNull public java.util.Iterator<Location> iterator()
iterator
in interface java.lang.Iterable<Location>
public void scroll(int dx, int dy, int width, int height)
dx
- the x distance to scrolldy
- the y distance to scrollwidth
- the map widthheight
- the map heightpublic void setSpeed(int speed)
speed
- the new animation speed to setpublic void setTickNo(int tickNo)
tickNo
- the current tick numberprivate void updateFace()
public void updateTickNo(int tickNo)
tickNo
- the tick number