Modifier and Type | Field and Description |
---|---|
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 int |
speed
The animation speed.
|
private int |
tickNo
The face was updated last in this tick number.
|
Constructor and Description |
---|
AnimationState(Animation animation,
int index)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
allocate(MapUpdaterState mapUpdaterState,
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(MapUpdaterState mapUpdaterState,
int speed)
Sets the animation speed.
|
void |
setTickNo(int tickNo)
Sets the tick number.
|
private void |
updateFace(MapUpdaterState mapUpdaterState)
Updates the map face from the state.
|
void |
updateTickNo(MapUpdaterState mapUpdaterState,
int tickNo)
Sets the tick number and update affected faces.
|
private int index
private int lastFace
@NotNull private final java.util.Set<Location> locations
locations
this animation is displayed at.private int speed
private int tickNo
public AnimationState(@NotNull Animation animation, int index)
animation
- the animation to displayindex
- the initial face indexpublic void allocate(@NotNull MapUpdaterState mapUpdaterState, @NotNull Location location)
Location
.mapUpdaterState
- the map updater state instance to uselocation
- 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(@NotNull MapUpdaterState mapUpdaterState, int speed)
mapUpdaterState
- the map updater state instance to usespeed
- the new animation speed to setpublic void setTickNo(int tickNo)
tickNo
- the current tick numberprivate void updateFace(@NotNull MapUpdaterState mapUpdaterState)
mapUpdaterState
- the map updater state instance to usepublic void updateTickNo(@NotNull MapUpdaterState mapUpdaterState, int tickNo)
mapUpdaterState
- the map updater state instance to usetickNo
- the tick number