public class AnimationMap
extends java.lang.Object
AnimationState
instances for map locations
.Modifier and Type | Field and Description |
---|---|
private java.util.Map<Location,AnimationState> |
animations
The active
AnimationState instances. |
Constructor and Description |
---|
AnimationMap() |
Modifier and Type | Method and Description |
---|---|
void |
add(MapUpdaterState mapUpdaterState,
Location location,
AnimationState animationState)
Adds a new
AnimationState to a Location . |
void |
clear()
Forgets all state.
|
private static void |
freeAnimationState(AnimationState animationState,
Location location)
|
void |
remove(Location location)
Clears a
Location . |
void |
scroll(int dx,
int dy,
int width,
int height)
Scrolls all locations.
|
void |
updateSpeed(MapUpdaterState mapUpdaterState,
Location location,
int speed)
Updates the animation speed value of a
Location . |
@NotNull private final java.util.Map<Location,AnimationState> animations
public void add(@NotNull MapUpdaterState mapUpdaterState, @NotNull Location location, @NotNull AnimationState animationState)
AnimationState
to a Location
. If the location
was not empty, the previous animation state is freed.mapUpdaterState
- the map updater state instance to uselocation
- the location to add toanimationState
- the animation state to addpublic void clear()
private static void freeAnimationState(@Nullable AnimationState animationState, @NotNull Location location)
animationState
- the instance to call free()
on or null
to do nothinglocation
- the location to passpublic void remove(@NotNull Location location)
Location
.location
- the location to clearpublic 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 updateSpeed(@NotNull MapUpdaterState mapUpdaterState, @NotNull Location location, int speed)
Location
.mapUpdaterState
- the map updater state instance to uselocation
- the location to updatespeed
- the new animation speed