com.jme.animation
Class AnimationEventManager

java.lang.Object
  extended by com.jme.animation.AnimationEventManager

public class AnimationEventManager
extends java.lang.Object

AnimationEventManager maintains a collection of animation triggers. A trigger is found using the BoneAnimation and the keyframe. The bone animation will request the list of events on a keyframe change. All events will have the performAction method called as needed from the bone animation.

Author:
Mark Powell

Method Summary
 void addAnimationEvent(BoneAnimation ba, java.lang.Integer key, AnimationEvent data)
          Adds a single animation event to the list of events for a specified animation at a given keyframe.
 void bind(BoneAnimation key, BoneAnimation original)
           
 java.util.HashMap<java.lang.Integer,java.util.ArrayList<AnimationEvent>> getAllEvents(BoneAnimation key)
          retrieves all events assigned to a BoneAnimation.
 java.util.ArrayList<AnimationEvent> getAnimationEventList(BoneAnimation ba, java.lang.Integer key)
           
 java.util.ArrayList<AnimationEvent> getEvents(BoneAnimation key, int frame)
          Obtains a list of events for a given animation at a specified frame.
 java.lang.Integer[] getFrames(BoneAnimation key)
          returns a list of frames that contain events for a given bone animation.
static AnimationEventManager getInstance()
          Obtains the singleton instance of the AnimationEventManager.
 boolean removeAnimationEvent(BoneAnimation ba, java.lang.Integer key, AnimationEvent event)
           
 java.util.ArrayList<AnimationEvent> removeAnimationEventList(BoneAnimation ba, java.lang.Integer key)
           
 void setAnimationEventList(BoneAnimation key, java.util.HashMap<java.lang.Integer,java.util.ArrayList<AnimationEvent>> data)
          stores a map of animation events for a specified animation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static AnimationEventManager getInstance()
Obtains the singleton instance of the AnimationEventManager.

Returns:
the singleton instance of AnimationEventManager.

getAllEvents

public java.util.HashMap<java.lang.Integer,java.util.ArrayList<AnimationEvent>> getAllEvents(BoneAnimation key)
retrieves all events assigned to a BoneAnimation.

Parameters:
key - the bone animation object to retrieve events for.
Returns:
the event collection for a given BoneAnimation.

getFrames

public java.lang.Integer[] getFrames(BoneAnimation key)
returns a list of frames that contain events for a given bone animation.

Parameters:
key - the bone animation to obtain the frames for.
Returns:
the list of frames that contain events.

getEvents

public java.util.ArrayList<AnimationEvent> getEvents(BoneAnimation key,
                                                     int frame)
Obtains a list of events for a given animation at a specified frame. If no events are defined for the animation at the specified frame, null is returned.

Parameters:
key - the animation to obtain the events for.
frame - the keyframe to obtain events for.
Returns:
the list of events for the provided animation at the provided frame, if no events are defined, null is returned.

setAnimationEventList

public void setAnimationEventList(BoneAnimation key,
                                  java.util.HashMap<java.lang.Integer,java.util.ArrayList<AnimationEvent>> data)
stores a map of animation events for a specified animation.

Parameters:
key - the animation that will be linked to the events.
data - the events to store.

addAnimationEvent

public void addAnimationEvent(BoneAnimation ba,
                              java.lang.Integer key,
                              AnimationEvent data)
Adds a single animation event to the list of events for a specified animation at a given keyframe.

Parameters:
ba - the animation to link to this event.
key - the frame to use to trigger the event.
data - the event.

getAnimationEventList

public java.util.ArrayList<AnimationEvent> getAnimationEventList(BoneAnimation ba,
                                                                 java.lang.Integer key)

removeAnimationEventList

public java.util.ArrayList<AnimationEvent> removeAnimationEventList(BoneAnimation ba,
                                                                    java.lang.Integer key)

removeAnimationEvent

public boolean removeAnimationEvent(BoneAnimation ba,
                                    java.lang.Integer key,
                                    AnimationEvent event)

bind

public void bind(BoneAnimation key,
                 BoneAnimation original)