c25741d8e6
tasks and XML parsing rule sets all the good stuff. Rewired up all the cast code to be amenable to bundling and did some other revamping. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@640 542714f4-19e9-0310-aa3c-eee0fc999fb1
66 lines
1.9 KiB
Java
66 lines
1.9 KiB
Java
//
|
|
// $Id: CharacterComponent.java,v 1.4 2001/11/27 08:09:34 mdb Exp $
|
|
|
|
package com.threerings.cast;
|
|
|
|
import java.io.Serializable;
|
|
|
|
import com.samskivert.util.StringUtil;
|
|
|
|
import com.threerings.media.sprite.MultiFrameImage;
|
|
import com.threerings.media.sprite.Sprite;
|
|
|
|
/**
|
|
* The character component represents a single component that can be
|
|
* composited with other character components to generate an image
|
|
* representing a complete character displayable in any of the eight
|
|
* compass directions as detailed in the {@link Sprite} class direction
|
|
* constants.
|
|
*/
|
|
public class CharacterComponent implements Serializable
|
|
{
|
|
/** The unique component identifier. */
|
|
public int componentId;
|
|
|
|
/** The component's name. */
|
|
public String name;
|
|
|
|
/** The class of components to which this one belongs. */
|
|
public ComponentClass componentClass;
|
|
|
|
/**
|
|
* Constructs a character component with the specified id of the
|
|
* specified class.
|
|
*/
|
|
public CharacterComponent (int componentId, String name,
|
|
ComponentClass compClass, FrameProvider fprov)
|
|
{
|
|
this.componentId = componentId;
|
|
this.name = name;
|
|
this.componentClass = compClass;
|
|
_frameProvider = fprov;
|
|
}
|
|
|
|
/**
|
|
* Returns the image frames for the specified action animation or null
|
|
* if no animation for the specified action is available for this
|
|
* component.
|
|
*/
|
|
public MultiFrameImage[] getFrames (String action)
|
|
{
|
|
return _frameProvider.getFrames(this, action);
|
|
}
|
|
|
|
/**
|
|
* Returns a string representation of this character component.
|
|
*/
|
|
public String toString ()
|
|
{
|
|
return "[componentId=" + componentId + ", name=" + name +
|
|
", class=" + componentClass + "]";
|
|
}
|
|
|
|
/** The entity from which we obtain our animation frames. */
|
|
protected FrameProvider _frameProvider;
|
|
}
|