Make them thar useful methods publicly available.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3605 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -33,6 +33,40 @@ import com.samskivert.util.ObserverList;
|
|||||||
*/
|
*/
|
||||||
public class Sprite extends Node
|
public class Sprite extends Node
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Walks down the hierarchy provided setting the animation speed on
|
||||||
|
* any controllers found along the way.
|
||||||
|
*/
|
||||||
|
public static void setAnimationSpeed (Spatial spatial, float speed)
|
||||||
|
{
|
||||||
|
for (int ii = 0; ii < spatial.getControllers().size(); ii++) {
|
||||||
|
spatial.getController(ii).setSpeed(speed);
|
||||||
|
}
|
||||||
|
if (spatial instanceof Node) {
|
||||||
|
Node node = (Node)spatial;
|
||||||
|
for (int ii = 0; ii < node.getQuantity(); ii++) {
|
||||||
|
setAnimationSpeed(node.getChild(ii), speed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Walks down the hierarchy provided turning on or off any controllers
|
||||||
|
* found along the way.
|
||||||
|
*/
|
||||||
|
public static void setAnimationActive (Spatial spatial, boolean active)
|
||||||
|
{
|
||||||
|
for (int ii = 0; ii < spatial.getControllers().size(); ii++) {
|
||||||
|
spatial.getController(ii).setActive(active);
|
||||||
|
}
|
||||||
|
if (spatial instanceof Node) {
|
||||||
|
Node node = (Node)spatial;
|
||||||
|
for (int ii = 0; ii < node.getQuantity(); ii++) {
|
||||||
|
setAnimationActive(node.getChild(ii), active);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Sprite ()
|
public Sprite ()
|
||||||
{
|
{
|
||||||
super("");
|
super("");
|
||||||
@@ -130,38 +164,6 @@ public class Sprite extends Node
|
|||||||
setAnimationActive(this, active);
|
setAnimationActive(this, active);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper function for {@link #setAnimationSpeed(float)}.
|
|
||||||
*/
|
|
||||||
protected static void setAnimationSpeed (Spatial spatial, float speed)
|
|
||||||
{
|
|
||||||
for (int ii = 0; ii < spatial.getControllers().size(); ii++) {
|
|
||||||
spatial.getController(ii).setSpeed(speed);
|
|
||||||
}
|
|
||||||
if (spatial instanceof Node) {
|
|
||||||
Node node = (Node)spatial;
|
|
||||||
for (int ii = 0; ii < node.getQuantity(); ii++) {
|
|
||||||
setAnimationSpeed(node.getChild(ii), speed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper function for {@link #setAnimationActive(boolean)}.
|
|
||||||
*/
|
|
||||||
protected static void setAnimationActive (Spatial spatial, boolean active)
|
|
||||||
{
|
|
||||||
for (int ii = 0; ii < spatial.getControllers().size(); ii++) {
|
|
||||||
spatial.getController(ii).setActive(active);
|
|
||||||
}
|
|
||||||
if (spatial instanceof Node) {
|
|
||||||
Node node = (Node)spatial;
|
|
||||||
for (int ii = 0; ii < node.getQuantity(); ii++) {
|
|
||||||
setAnimationActive(node.getChild(ii), active);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Used to dispatch {@link PathObserver#pathCancelled}. */
|
/** Used to dispatch {@link PathObserver#pathCancelled}. */
|
||||||
protected static class CancelledOp implements ObserverList.ObserverOp
|
protected static class CancelledOp implements ObserverList.ObserverOp
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user