Added facilities for specifying the resting and path-following actions

because they won't always be standing and walking.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1056 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-02-19 22:09:08 +00:00
parent 12dd0ff1c7
commit e7022fcfff
@@ -1,5 +1,5 @@
// //
// $Id: CharacterSprite.java,v 1.20 2001/12/17 03:33:40 mdb Exp $ // $Id: CharacterSprite.java,v 1.21 2002/02/19 22:09:08 mdb Exp $
package com.threerings.cast; package com.threerings.cast;
@@ -29,6 +29,24 @@ public class CharacterSprite
_orient = NORTH; _orient = NORTH;
} }
/**
* Specifies the action to use when the sprite is at rest. The default
* is <code>STANDING</code>.
*/
public void setRestingAction (String action)
{
_restingAction = action;
}
/**
* Specifies the action to use when the sprite is following a path.
* The default is <code>WALKING</code>.
*/
public void setFollowingPathAction (String action)
{
_followingPathAction = action;
}
/** /**
* Sets the action sequence used when rendering the character, from * Sets the action sequence used when rendering the character, from
* the set of available sequences. * the set of available sequences.
@@ -106,7 +124,7 @@ public class CharacterSprite
super.pathBeginning(); super.pathBeginning();
// enable walking animation // enable walking animation
setActionSequence(WALKING); setActionSequence(_followingPathAction);
setAnimationMode(TIME_BASED); setAnimationMode(TIME_BASED);
} }
@@ -126,9 +144,15 @@ public class CharacterSprite
// disable animation // disable animation
setAnimationMode(NO_ANIMATION); setAnimationMode(NO_ANIMATION);
// come to a halt looking settled and at peace // come to a halt looking settled and at peace
setActionSequence(STANDING); setActionSequence(_restingAction);
} }
/** The action to use when at rest. */
protected String _restingAction = STANDING;
/** The action to use when following a path. */
protected String _followingPathAction = WALKING;
/** A reference to the descriptor for the character that we're /** A reference to the descriptor for the character that we're
* visualizing. */ * visualizing. */
protected CharacterDescriptor _descrip; protected CharacterDescriptor _descrip;