本文整理汇总了Java中com.badlogic.gdx.graphics.g3d.utils.AnimationController类的典型用法代码示例。如果您正苦于以下问题:Java AnimationController类的具体用法?Java AnimationController怎么用?Java AnimationController使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AnimationController类属于com.badlogic.gdx.graphics.g3d.utils包,在下文中一共展示了AnimationController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Basic
import com.badlogic.gdx.graphics.g3d.utils.AnimationController; //导入依赖的package包/类
public Basic(Matrix4 transform, double speeed, int hp, int health, int range, float coolDown, EnumSet<Types> types, EnumSet<Effects> effects, ModelInstance instance, btCollisionWorld world, IntMap<Entity> entities, List<Vector3> path, Map<String, Sound> sounds) {
super(transform, speeed, hp, health, range, coolDown, types, effects, instance, new btCompoundShape(), world, entities, ATTACK_ANIMATION, ATTACK_OFFSET, path, sounds);
((btCompoundShape)shape).addChildShape(new Matrix4(new Vector3(0, 30, 0), new Quaternion().setEulerAngles(0, 0, 0), new Vector3(1, 1, 1)), new btBoxShape(new Vector3(75, 30, 90)));
//System.out.println(getModelInstance().getAnimation("Spider_Armature|walk_ani_vor").id);
listener = new AnimationController.AnimationListener() {
@Override
public void onEnd(AnimationController.AnimationDesc animationDesc) {
}
@Override
public void onLoop(AnimationController.AnimationDesc animationDesc) {
}
};
//animation.setAnimation("Spider_Armature|walk_ani_vor");
//animation.animate("Spider_Armature|walk_ani_vor", -1);
//animation.action("Spider_Armature|walk_ani_vor", 0, 1000, -1, 1, listener, 0);
//animation.animate("Spider_Armature|Attack", 0, 1000, 1, 1, listener, 0);
//animation.queue("Spider_Armature|walk_ani_vor", 0, 1000, -1, 1, listener, 0);
}
示例2: Shark
import com.badlogic.gdx.graphics.g3d.utils.AnimationController; //导入依赖的package包/类
public Shark() {
hasPhysics = true;
vitesse = (float) (4f+Math.random()*6f);
if(animations==null) {
animations = new Hashtable<String, Shark.Animation>();
for(Animation anim : anims) {
animations.put(anim.id, anim);
}
}
targetDir.setToRandomDirection();
targetDir.y=0;
targetDir.nor();
size.set(0.016f, 0.016f, 0.016f);
model = new ModelInstance(Assets.requin);
transform = model.transform;
animation = new AnimationController(model);
animation.allowSameAnimation=true;
animation.setAnimation( getNomAnimation(), -1);
}
示例3: GameObject
import com.badlogic.gdx.graphics.g3d.utils.AnimationController; //导入依赖的package包/类
public GameObject(ScreenBase context, Model model, BoundingBox bounds) {
super(model);
this.context = context;
this.customBounds = bounds;
this.bounds = this.customBounds != null ? this.customBounds : new BoundingBox();
this.center = new Vector3();
this.enabled = true;
updateBox();
this.animations = new AnimationController(this);
this.blending = new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
for(Material item : materials){
item.set(new DepthTestAttribute(GL20.GL_LEQUAL, 0.01f, 25f, true));
item.set(FloatAttribute.createAlphaTest(0.01f));
item.set(blending);
}
}
示例4: switchAnimation
import com.badlogic.gdx.graphics.g3d.utils.AnimationController; //导入依赖的package包/类
protected void switchAnimation () {
for (ObjectMap.Entry<ModelInstance, AnimationController> e : animationControllers.entries()) {
int animIndex = 0;
if (e.value.current != null) {
for (int i = 0; i < e.key.animations.size; i++) {
final Animation animation = e.key.animations.get(i);
if (e.value.current.animation == animation) {
animIndex = i;
break;
}
}
}
animIndex = (animIndex + 1) % e.key.animations.size;
e.value.animate(e.key.animations.get(animIndex).id, -1, 1f, null, 0.2f);
}
}
示例5: onLoaded
import com.badlogic.gdx.graphics.g3d.utils.AnimationController; //导入依赖的package包/类
@Override
protected void onLoaded () {
if (currentlyLoading == null || currentlyLoading.length() == 0) return;
instances.clear();
animationControllers.clear();
final ModelInstance instance = new ModelInstance(assets.get(currentlyLoading, Model.class));
instance.transform = transform;
instances.add(instance);
if (instance.animations.size > 0) animationControllers.put(instance, new AnimationController(instance));
currentlyLoading = null;
instance.calculateBoundingBox(bounds);
cam.position.set(1, 1, 1).nor().scl(bounds.getDimensions().len() * 0.75f + bounds.getCenter().len());
cam.up.set(0, 1, 0);
cam.lookAt(0, 0, 0);
cam.far = 50f + bounds.getDimensions().len() * 2.0f;
cam.update();
}
示例6: switchAnimation
import com.badlogic.gdx.graphics.g3d.utils.AnimationController; //导入依赖的package包/类
protected void switchAnimation () {
for (ObjectMap.Entry<ModelInstance, AnimationController> e : animationControllers.entries()) {
int animIndex = 0;
if (e.value.current != null) {
for (int i = 0; i < e.key.animations.size; i++) {
final Animation animation = e.key.animations.get(i);
if (e.value.current.animation == animation) {
animIndex = i;
break;
}
}
}
animIndex = (animIndex + 1) % (e.key.animations.size + 1);
e.value.animate((animIndex == e.key.animations.size) ? null : e.key.animations.get(animIndex).id, -1, 1f, null, 0.2f);
}
}
示例7: AreaDisplayable
import com.badlogic.gdx.graphics.g3d.utils.AnimationController; //导入依赖的package包/类
public AreaDisplayable(Model model) {
instance = new ModelInstance(model);
animationController = new AnimationController(instance);
instance.transform.rotate(new Vector3(1, 0, 0), 90);
for (Material material : instance.materials) {
TextureAttribute ta
= (TextureAttribute) material.get(TextureAttribute.Diffuse);
ta.textureDescription.magFilter = Texture.TextureFilter.Nearest;
ta.textureDescription.minFilter = Texture.TextureFilter.Nearest;
material.set(ta);
material.set(ColorAttribute.createDiffuse(Color.WHITE));
BlendingAttribute ba = new BlendingAttribute(GL20.GL_SRC_ALPHA,
GL20.GL_ONE_MINUS_SRC_ALPHA);
material.set(ba);
}
}
示例8: retrieveSource
import com.badlogic.gdx.graphics.g3d.utils.AnimationController; //导入依赖的package包/类
private void retrieveSource(String source) {
ModelCacheEntry entry = (ModelCacheEntry)sourceCache.get(source);
if (entry == null || entry.refCounter < 1) {
loadSource(source);
EngineAssetManager.getInstance().finishLoading();
entry = (ModelCacheEntry)sourceCache.get(source);
}
if (entry.modelInstance == null) {
Model model3d = EngineAssetManager.getInstance().getModel3D(source);
entry.modelInstance = new ModelInstance(model3d);
entry.controller = new AnimationController(entry.modelInstance);
entry.camera3d = getCamera(entry.modelInstance);
}
}
示例9: RobotEntity
import com.badlogic.gdx.graphics.g3d.utils.AnimationController; //导入依赖的package包/类
public RobotEntity(Model model) {
super(model);
//scale.set(0.35f, 0.35f, 0.35f);
animation = new AnimationController(instance);
animation.setAnimation(ANIMATION_IDLE);
this.headBone = instance.getNode("Head");
this.frontRightBone = instance.getNode("FrontRightWheel");
this.frontLeftBone = instance.getNode("FrontLeftWheel");
this.backLeftBone = instance.getNode("BackLeftWheel");
this.backRightBone = instance.getNode("BackRightWheel");
this.sonarSprite = BotLogic.sprites.sonarDecal();
}
示例10: Entity
import com.badlogic.gdx.graphics.g3d.utils.AnimationController; //导入依赖的package包/类
public Entity(Matrix4 transform, int hp, int health, EnumSet<Types> types, EnumSet<Effects> effects, ModelInstance instance, btCollisionShape shape, btCollisionWorld world, IntMap<Entity> entities, Map<String, Sound> sounds){
this.instance = instance;
this.transform = transform;
this.hp = hp;
this.types = types;
this.health = health;
this.effects = effects;
this.sounds = sounds;
animation = new AnimationController(instance);
this.instance.transform.set(transform);
this.shape = shape;
body = new btCollisionObject();
body.setCollisionShape(shape);
body.setWorldTransform(this.instance.transform);
this.world = world;
tempVector = new Vector3();
tempVector2 = new Vector3();
this.entities = entities;
tempQuaternion = new Quaternion();
quaternion = new Quaternion();
if(this instanceof Enemy || this instanceof Projectile)
body.setCollisionFlags(body.getCollisionFlags());
int index = getNextIndex();
entities.put(index, this);
body.setUserValue(index);
world.addCollisionObject(body);
boundingBox = instance.calculateBoundingBox(new BoundingBox());
//for(Node node: instance.nodes)
//System.out.println();
}
示例11: buildWithModel
import com.badlogic.gdx.graphics.g3d.utils.AnimationController; //导入依赖的package包/类
public void buildWithModel(ModelInstance m) {
model = m;
boundingBox = new BoundingBox();
model.calculateBoundingBox(boundingBox);
Vector3 dimensions = boundingBox.getDimensions(new Vector3());
radius = dimensions.len() / 2f;
state = ModelComponent.State.READY;
if (m.animations.size > 0) {
animationController = new AnimationController(model);
}
}
示例12: Monster
import com.badlogic.gdx.graphics.g3d.utils.AnimationController; //导入依赖的package包/类
public Monster() {
hasPhysics = true;
vitesse = (float) (1f+Math.random()*4f);
// gravity = 100f;
if(animations==null) {
animations = new Hashtable<String, Shark.Animation>();
for(Animation anim : anims) {
animations.put(anim.id, anim);
}
}
dir.setToRandomDirection();
targetDir.setToRandomDirection();
targetDir.y=0;
targetDir.nor();
size.set(2f, 2f, 2f);
model = new ModelInstance(Assets.golem);
transform = model.transform;
baseRotationY = 15f;
animation = new AnimationController(model);
animation.allowSameAnimation=true;
animation.setAnimation( getNomAnimation(), -1);
}
示例13: DogCharacter
import com.badlogic.gdx.graphics.g3d.utils.AnimationController; //导入依赖的package包/类
public DogCharacter(Model model, String name,
Vector3 location, Vector3 rotation, Vector3 scale,
btCollisionShape shape, float mass,
short belongsToFlag, short collidesWithFlag,
boolean callback, boolean noDeactivate) {
super(model, name,
location, rotation, scale,
shape, mass,
belongsToFlag, collidesWithFlag,
callback, noDeactivate,
new DogSteerSettings());
// Create behavior tree through the library
BehaviorTreeLibraryManager btlm = BehaviorTreeLibraryManager.getInstance();
this.tree = btlm.createBehaviorTree("btrees/dog.btree", this);
// Create animation controller
animations = new AnimationController(modelInstance);
// Create path follower
followPathSteerer = new FollowPathSteerer(this);
// Create wander steerer
wanderSteerer = new WanderSteerer(this);
// Init flags
humanWantToPlay = false;
stickThrown = false;
alreadyCriedForHumanDeath = false;
humanIsDead = false;
}
示例14: HumanCharacter
import com.badlogic.gdx.graphics.g3d.utils.AnimationController; //导入依赖的package包/类
public HumanCharacter(Model model,
String name,
Vector3 location,
Vector3 rotation,
Vector3 scale,
btCollisionShape shape,
float mass,
short belongsToFlag,
short collidesWithFlag,
boolean callback,
boolean noDeactivate,
Array<BlenderEmpty> ragdollEmpties,
String armatureNodeId) {
super(model, name, location, rotation, scale,
shape, mass, belongsToFlag, collidesWithFlag,
callback, noDeactivate, ragdollEmpties, armatureNodeId,
new HumanSteerSettings());
// Create path follower
followPathSteerer = new FollowPathSteerer(this);
// Create the animation controllers
animations = new AnimationController(modelInstance);
// Create animation listeners for states that need one
stateAnimationListeners = new EnumMap<HumanState, AnimationListener>(HumanState.class);
stateAnimationListeners.put(HumanState.THROW, new AnimationListener());
// Create the state machine
stateMachine = new DefaultStateMachine<HumanCharacter, HumanState>(this);
// Set the steering variables associated with default move state (walking)
stateMachine.changeState(moveState);
// Then make the character idle
stateMachine.changeState(moveState.idleState);
}
示例15: render
import com.badlogic.gdx.graphics.g3d.utils.AnimationController; //导入依赖的package包/类
@Override
protected void render (ModelBatch batch, Array<ModelInstance> instances) {
for (ObjectMap.Entry<ModelInstance, AnimationController> e : animationControllers.entries())
e.value.update(Gdx.graphics.getDeltaTime());
for (final ModelInstance instance : instances)
renderSkeleton(instance);
batch.render(instances);
}