public class CfMapAnimations
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private AnimationMap |
animations
The animations in the visible map area.
|
private java.util.Map<AnimationState,java.lang.Void> |
animationStates
All
AnimationState instances referenced by animations . |
private int |
height
The height of the visible map area.
|
private java.util.Collection<AnimationState> |
pendingTickUpdates
The
AnimationState instances that have been added but not yet
received a "tick" value. |
private java.util.Random |
random
The random number generator for
Map2.ANIM_RANDOM type
animations. |
private java.util.Map<java.lang.Integer,AnimationState> |
syncAnimationStates
All
AnimationState for Map2.ANIM_SYNC animations. |
private int |
width
The width of the visible map area.
|
Constructor and Description |
---|
CfMapAnimations() |
Modifier and Type | Method and Description |
---|---|
void |
add(MapUpdaterState mapUpdaterState,
Location location,
Animation animation,
int type)
Adds a visible animation.
|
void |
clear()
Forgets all animations.
|
void |
remove(int x,
int y)
Removes all visible animations for a tile.
|
void |
remove(Location location)
Removes a visible animation.
|
void |
scroll(int dx,
int dy)
Scrolls the animations.
|
void |
setMapSize(int width,
int height)
Updates the map size.
|
void |
tick(MapUpdaterState mapUpdaterState,
int tickNo)
Processes a tick command.
|
void |
updateSpeed(MapUpdaterState mapUpdaterState,
Location location,
int speed)
Updates the animation speed value.
|
@NotNull private final AnimationMap animations
@NotNull private final java.util.Map<AnimationState,java.lang.Void> animationStates
AnimationState
instances referenced by animations
.private int height
@NotNull private final java.util.Collection<AnimationState> pendingTickUpdates
AnimationState
instances that have been added but not yet
received a "tick" value.@NotNull private final java.util.Random random
Map2.ANIM_RANDOM
type
animations.@NotNull private final java.util.Map<java.lang.Integer,AnimationState> syncAnimationStates
AnimationState
for Map2.ANIM_SYNC
animations.private int width
public void add(@NotNull MapUpdaterState mapUpdaterState, @NotNull Location location, @NotNull Animation animation, int type)
mapUpdaterState
- the map updater state instance to uselocation
- the location to animateanimation
- the animation to displaytype
- the animation typepublic void clear()
public void remove(int x, int y)
x
- the x-coordinate to un-animatey
- the y-coordinate to un-animatepublic void remove(@NotNull Location location)
location
- the location to un-animatepublic void scroll(int dx, int dy)
dx
- the x-distance to scrolldy
- the y-distance to scrollpublic void setMapSize(int width, int height)
width
- the map widthheight
- the map heightpublic void tick(@NotNull MapUpdaterState mapUpdaterState, int tickNo)
mapUpdaterState
- the instance to updatetickNo
- the current tick numberpublic void updateSpeed(@NotNull MapUpdaterState mapUpdaterState, @NotNull Location location, int speed)
mapUpdaterState
- the map updater state instance to uselocation
- the location to updatespeed
- the new animation speed