public final class AnimationStateMachine extends java.lang.Object implements IAnimationStateMachine
Modifier and Type | Class and Description |
---|---|
private static class |
AnimationStateMachine.ClipResolver |
private static class |
AnimationStateMachine.ParameterResolver |
private static class |
AnimationStateMachine.TransitionsAdapterFactory |
Modifier and Type | Field and Description |
---|---|
private static com.google.gson.Gson |
asmGson |
private static com.google.common.cache.LoadingCache<org.apache.commons.lang3.tuple.Triple<? extends IClip,java.lang.Float,java.lang.Float>,org.apache.commons.lang3.tuple.Pair<IModelTransform,java.lang.Iterable<Event>>> |
clipCache |
private com.google.common.collect.ImmutableMap<java.lang.String,IClip> |
clips |
private IClip |
currentState |
private java.lang.String |
currentStateName |
private float |
lastPollTime |
private static org.apache.logging.log4j.Logger |
LOGGER |
private static AnimationStateMachine |
missing |
private com.google.common.collect.ImmutableMap<java.lang.String,ITimeValue> |
parameters |
private boolean |
shouldHandleSpecialEvents |
private java.lang.String |
startState |
private com.google.common.collect.ImmutableList<java.lang.String> |
states |
private com.google.common.collect.ImmutableMultimap<java.lang.String,java.lang.String> |
transitions |
Constructor and Description |
---|
AnimationStateMachine(com.google.common.collect.ImmutableMap<java.lang.String,ITimeValue> parameters,
com.google.common.collect.ImmutableMap<java.lang.String,IClip> clips,
com.google.common.collect.ImmutableList<java.lang.String> states,
com.google.common.collect.ImmutableMultimap<java.lang.String,java.lang.String> transitions,
java.lang.String startState) |
Modifier and Type | Method and Description |
---|---|
org.apache.commons.lang3.tuple.Pair<IModelTransform,java.lang.Iterable<Event>> |
apply(float time)
Sample the state and events at the current time.
|
java.lang.String |
currentState()
Get current state name.
|
static AnimationStateMachine |
getMissing() |
(package private) void |
initialize()
post-loading initialization hook.
|
static IAnimationStateMachine |
load(IResourceManager manager,
ResourceLocation location,
com.google.common.collect.ImmutableMap<java.lang.String,ITimeValue> customParameters)
Load a new instance if AnimationStateMachine at specified location, with specified custom parameters.
|
void |
shouldHandleSpecialEvents(boolean value)
Set to true if the machine should handle special events that come from the clips (they start with '!').
|
void |
transition(java.lang.String newState)
Transition to a new state.
|
private static final org.apache.logging.log4j.Logger LOGGER
private final com.google.common.collect.ImmutableMap<java.lang.String,ITimeValue> parameters
private final com.google.common.collect.ImmutableMap<java.lang.String,IClip> clips
private final com.google.common.collect.ImmutableList<java.lang.String> states
private final com.google.common.collect.ImmutableMultimap<java.lang.String,java.lang.String> transitions
@SerializedName(value="start_state") private final java.lang.String startState
private transient boolean shouldHandleSpecialEvents
private transient java.lang.String currentStateName
private transient IClip currentState
private transient float lastPollTime
private static final com.google.common.cache.LoadingCache<org.apache.commons.lang3.tuple.Triple<? extends IClip,java.lang.Float,java.lang.Float>,org.apache.commons.lang3.tuple.Pair<IModelTransform,java.lang.Iterable<Event>>> clipCache
private static final AnimationStateMachine missing
private static final com.google.gson.Gson asmGson
public AnimationStateMachine(com.google.common.collect.ImmutableMap<java.lang.String,ITimeValue> parameters, com.google.common.collect.ImmutableMap<java.lang.String,IClip> clips, com.google.common.collect.ImmutableList<java.lang.String> states, com.google.common.collect.ImmutableMultimap<java.lang.String,java.lang.String> transitions, java.lang.String startState)
void initialize()
public org.apache.commons.lang3.tuple.Pair<IModelTransform,java.lang.Iterable<Event>> apply(float time)
IAnimationStateMachine
apply
in interface IAnimationStateMachine
public void transition(java.lang.String newState)
IAnimationStateMachine
transition
in interface IAnimationStateMachine
public java.lang.String currentState()
IAnimationStateMachine
currentState
in interface IAnimationStateMachine
public void shouldHandleSpecialEvents(boolean value)
IAnimationStateMachine
shouldHandleSpecialEvents
in interface IAnimationStateMachine
public static IAnimationStateMachine load(IResourceManager manager, ResourceLocation location, com.google.common.collect.ImmutableMap<java.lang.String,ITimeValue> customParameters)
public static AnimationStateMachine getMissing()