2015-04-08 19:15:14 +02:00
|
|
|
package com.saltosion.gladiator.components;
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
|
|
import com.badlogic.ashley.core.Component;
|
|
|
|
import com.badlogic.gdx.graphics.g2d.Sprite;
|
2015-04-10 16:30:30 +02:00
|
|
|
import com.saltosion.gladiator.util.SpriteSequence;
|
2015-04-08 19:15:14 +02:00
|
|
|
|
|
|
|
public class CRenderedObject extends Component {
|
2015-04-08 19:50:13 +02:00
|
|
|
private HashMap<String, SpriteSequence> spritesequences = new HashMap<String, SpriteSequence>();
|
|
|
|
private String currentSequence = "";
|
|
|
|
private float currentframe = 0;
|
|
|
|
|
|
|
|
public CRenderedObject() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Can be used if the Rendered Object is a single static image always.
|
|
|
|
* @param sprite
|
|
|
|
*/
|
|
|
|
public CRenderedObject(Sprite sprite) {
|
|
|
|
spritesequences.put("Idle", new SpriteSequence(sprite));
|
|
|
|
currentSequence = "Idle";
|
|
|
|
}
|
|
|
|
|
|
|
|
public void addSequence(String key, SpriteSequence sequence) {
|
|
|
|
spritesequences.put(key, sequence);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setCurrentSequence(String sequence) {
|
|
|
|
this.currentSequence = sequence;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setCurrentFrame(float frame) {
|
|
|
|
this.currentframe = frame;
|
|
|
|
}
|
|
|
|
|
|
|
|
public SpriteSequence getSequence(String key) {
|
|
|
|
return spritesequences.get(key);
|
|
|
|
}
|
|
|
|
|
|
|
|
public float getCurrentFrame() {
|
|
|
|
return currentframe;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getCurrentSequence() {
|
|
|
|
return currentSequence;
|
|
|
|
}
|
|
|
|
|
2015-04-08 19:15:14 +02:00
|
|
|
}
|