More work on character components.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@579 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Walter Korman
2001-10-30 16:16:01 +00:00
parent 933a427b68
commit 3ea91cdfdd
19 changed files with 1099 additions and 191 deletions
@@ -1,9 +1,10 @@
//
// $Id: CharacterComponent.java,v 1.1 2001/10/26 01:17:21 shaper Exp $
// $Id: CharacterComponent.java,v 1.2 2001/10/30 16:16:01 shaper Exp $
package com.threerings.cast;
import com.threerings.media.sprite.MultiFrameImage;
import com.threerings.media.sprite.Sprite;
/**
* The character component represents a single component that can be
@@ -17,14 +18,16 @@ public class CharacterComponent
/**
* Constructs a character component.
*/
public CharacterComponent (ComponentType type, int cid,
ComponentFrames frames)
public CharacterComponent (
ComponentType type, ComponentClass cclass, int cid,
ComponentFrames frames)
{
_type = type;
_cclass = cclass;
_cid = cid;
_frames = frames;
}
/**
* Returns the unique component identifier.
*/
@@ -42,20 +45,28 @@ public class CharacterComponent
}
/**
* Returns the {@link ComponentType} object describing the base
* component type information associated with this component.
* Returns the component type associated with this component.
*/
public ComponentType getType ()
{
return _type;
}
/**
* Returns the component class associated with this component.
*/
public ComponentClass getComponentClass ()
{
return _cclass;
}
/**
* Returns a string representation of this character component.
*/
public String toString ()
{
return "[cid=" + _cid + ", type=" + _type + "]";
return "[cid=" + _cid + ", clid=" + _cclass.clid +
", type=" + _type + "]";
}
/**
@@ -70,6 +81,15 @@ public class CharacterComponent
/** The walking animations in each orientation. */
public MultiFrameImage walk[];
/**
* Constructs a component frames object.
*/
public ComponentFrames ()
{
stand = new MultiFrameImage[Sprite.NUM_DIRECTIONS];
walk = new MultiFrameImage[Sprite.NUM_DIRECTIONS];
}
}
/** The unique character component identifier. */
@@ -78,6 +98,9 @@ public class CharacterComponent
/** The animation frames. */
protected ComponentFrames _frames;
/** The component class. */
protected ComponentClass _cclass;
/** The character component type. */
protected ComponentType _type;
}