use of eidolons.libgdx.anims.particles.EmitterActor in project Eidolons by IDemiurge.
the class MapParticles method init.
public void init() {
map.put(null, new ArrayList<>());
for (DAY_TIME sub : DAY_TIME.values()) {
map.put(sub, new ArrayList<>());
}
load();
for (MAP_EMITTER_GROUP sub : MAP_EMITTER_GROUP.values()) {
boolean displayed = false;
for (DAY_TIME time : sub.times) {
if (time == this.time) {
displayed = true;
break;
}
// same check for weather perhaps
}
if (sub.points != null)
for (MAP_POINTS point : sub.points) {
for (int i = 0; i < sub.number; i++) {
int mod = (i % 2 == 0) ? 1 : -1;
int offsetX = mod * sub.distance * i;
mod = (i % 3 == 0) ? 1 : -1;
int offsetY = mod * sub.distance * i;
EmitterActor emitter = create(sub.sfxPath, point.x + offsetX, point.y + offsetY, time);
if (displayed) {
this.displayed.add(emitter);
}
}
}
}
initialized = true;
}
use of eidolons.libgdx.anims.particles.EmitterActor in project Eidolons by IDemiurge.
the class EditorParticleMaster method removeClosest.
public void removeClosest(int x, int y) {
float minDistance = Float.MAX_VALUE;
Actor actor = null;
DequeImpl<Actor> list = new DequeImpl<>(particles.getEmitterMap().get(time));
list.addAll(map.get(time));
for (Actor sub : list) {
if (sub instanceof EmitterActor) {
float distance = new Vector2(x, y).dst(new Vector2(sub.getX(), sub.getY()));
if (distance < minDistance) {
minDistance = distance;
actor = sub;
}
}
// can we not attach click listeners to emtiterActors?!
}
removeEmitter((EmitterActor) actor, time);
}
use of eidolons.libgdx.anims.particles.EmitterActor in project Eidolons by IDemiurge.
the class EditorParticleMaster method save.
public void save(DAY_TIME time) {
Set<EmitterActor> emitterActors = new LinkedHashSet<>(map.get(time));
try {
emitterActors.addAll(particles.getEmitterMap().get(time));
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
String contents = "";
for (EmitterActor sub : emitterActors) {
String s = sub.getPath() + StringMaster.wrapInParenthesis(new Coordinates(true, (int) sub.getX(), (int) sub.getY()).toString()) + ";\n";
contents += s;
}
String s;
if (time == null)
s = "all";
else
s = time.toString();
String path = getPath() + s + ".txt";
FileManager.write(contents, path);
}
use of eidolons.libgdx.anims.particles.EmitterActor in project Eidolons by IDemiurge.
the class EditorParticleMaster method removeLast.
public void removeLast() {
if (stack.isEmpty())
return;
EmitterActor last = stack.pop();
removeEmitter(last, time);
}
use of eidolons.libgdx.anims.particles.EmitterActor in project Eidolons by IDemiurge.
the class MapObjStage method removeClosest.
public void removeClosest(int x, int y) {
float minDistance = Float.MAX_VALUE;
Actor actor = null;
for (Actor sub : getRoot().getChildren()) {
if (sub instanceof EmitterActor) {
float distance = new Vector2(x, y).dst(new Vector2(sub.getX(), sub.getY()));
if (distance < minDistance) {
minDistance = distance;
actor = sub;
}
}
}
GuiEventManager.trigger(MapEvent.REMOVE_MAP_OBJ, actor);
}
Aggregations