use of com.watabou.pixeldungeon.sprites.MobSpriteDef in project pixel-dungeon-remix by NYRDS.
the class Mob method sprite.
public CharSprite sprite() {
try {
{
String descName = "spritesDesc/" + getMobClassName() + ".json";
if (ModdingMode.isResourceExist(descName) || ModdingMode.isAssetExist(descName)) {
return new MobSpriteDef(descName, getKind());
}
}
if (spriteClass instanceof Class) {
CharSprite sprite = (CharSprite) ((Class<?>) spriteClass).newInstance();
sprite.selectKind(getKind());
return sprite;
}
if (spriteClass instanceof String) {
return new MobSpriteDef((String) spriteClass, getKind());
}
throw new TrackedRuntimeException(String.format("sprite creation failed - mob class %s", getMobClassName()));
} catch (Exception e) {
throw new TrackedRuntimeException(e);
}
}
Aggregations