本文整理汇总了Java中com.artemis.EntityEdit.create方法的典型用法代码示例。如果您正苦于以下问题:Java EntityEdit.create方法的具体用法?Java EntityEdit.create怎么用?Java EntityEdit.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.artemis.EntityEdit
的用法示例。
在下文中一共展示了EntityEdit.create方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
import com.artemis.EntityEdit; //导入方法依赖的package包/类
@Override
protected void process(final int entityId)
{
final Position p = mPos.get(entityId);
final Size size = mSize.get(entityId);
final Name name = mName.get(entityId);
// remove dead creature from the world
map.obstacles.del(p.x, p.y);
world.delete(entityId);
final Point p2 = map.getFirstTotallyFree(p.x, p.y, -1);
// add corpse item
final int corpseId = world.create();
final EntityEdit edit = world.edit(corpseId);
edit.create(Position.class).set(p2.x, p2.y);
edit.create(Sprite.class).set('$', Color.RED.darker().darker(), false);
edit.create(Corpse.class);
edit.create(Health.class).set(size.value + 3);
edit.add(new Name(name.name + "'s corpse", "corpse"));
map.items.set(corpseId, p2.x, p2.y);
}
示例2: createFadingTileLabel
import com.artemis.EntityEdit; //导入方法依赖的package包/类
public static Entity createFadingTileLabel(World world, String label, Color color, float x, float y, float duration) {
Entity e = world.createEntity();
EntityEdit edit = e.edit();
MutableMapPosition position = edit.create(MutableMapPosition.class);
position.x = x;
position.y = y;
FadingMessage fading = edit.create(FadingMessage.class);
fading.label = label;
fading.color = color;
fading.duration = duration;
fading.vx = 0f;
fading.vy = 1.3f;
return e;
}
示例3: createFadingTileIcon
import com.artemis.EntityEdit; //导入方法依赖的package包/类
public static Entity createFadingTileIcon(World world, TextureRegion icon, Color color, float x, float y,
float duration) {
Entity e = world.createEntity();
EntityEdit edit = e.edit();
MutableMapPosition position = edit.create(MutableMapPosition.class);
position.x = x;
position.y = y;
FadingMessage fading = edit.create(FadingMessage.class);
fading.icon = icon;
fading.color = color;
fading.duration = duration;
fading.vx = 0f;
fading.vy = 1.3f;
return e;
}
示例4: createClick
import com.artemis.EntityEdit; //导入方法依赖的package包/类
public static Entity createClick(World world, int x, int y, float startScale, float speed) {
Entity e = world.createEntity();
EntityEdit edit = e.edit();
MutableMapPosition pos = edit.create(MutableMapPosition.class);
pos.x = x;
pos.y = y;
Sprite sprite = new Sprite();
sprite.name = "click";
sprite.color = new Color(1f, 1f, 1f, 0.5f);
sprite.rotation = 0f;
sprite.scaleX = startScale;
sprite.scaleY = startScale;
edit.add(sprite);
Expires expires = edit.create(Expires.class);
expires.delay = 1f;
ScaleAnimation scaleAnimation = edit.create(ScaleAnimation.class);
scaleAnimation.speed = speed;
ColorAnimation colorAnimation = edit.create(ColorAnimation.class);
colorAnimation.alphaAnimate = true;
colorAnimation.alphaSpeed = -1f;
return e;
}
示例5: loadBody
import com.artemis.EntityEdit; //导入方法依赖的package包/类
public void loadBody(final String filename, final EntityEdit edit) throws IOException
{
// final InputStream fileStream = loader.getResourceAsStream(filename);
final InputStream fileStream = new FileInputStream(filename);
final YAMLFactory factory = new YAMLFactory();
final YAMLParser parser = factory.createParser(fileStream);
int str = 0, agi = 0, con = 0, skin = 0, sight = 0;
boolean herbivore = false, carnivore = false;
parser.nextToken(); // START_OBJECT
while (parser.nextToken() != null)
{
final String name = parser.getCurrentName();
if (name == null)
break;
parser.nextToken(); // get value for this "name"
switch (name)
{
case "strength":
str = parser.getIntValue();
edit.create(Strength.class).value = Util.clamp(str, -2, 2);
break;
case "agility":
agi = parser.getIntValue();
edit.create(Agility.class).value = Util.clamp(agi, -2, 2);
break;
case "constitution":
con = parser.getIntValue();
edit.create(Constitution.class).value = Util.clamp(con, -2, 2);
break;
case "skin":
skin = parser.getIntValue();
edit.create(Skin.class).value = Util.clamp(skin, -2, 2);
break;
case "sight":
sight = parser.getIntValue();
edit.create(Sight.class).value = Util.clamp(sight, 1, 18);
break;
case "herbivore":
herbivore = parser.getBooleanValue();
if (herbivore)
edit.create(Herbivore.class);
break;
case "carnivore":
carnivore = parser.getBooleanValue();
if (carnivore)
edit.create(Carnivore.class);
break;
case "underwater":
edit.create(Underwater.class);
break;
}
}
// Secondary Attributes
final int size = Math.round((con - agi) / 2f);
edit.create(Size.class).set(size);
edit.create(Stamina.class).set((5 + str + con) * 100); // FIXME for debug, reduce/tweak later
edit.create(Speed.class).set((con - str - agi + 6) / 12f);
edit.create(Health.class).set((con + 3) * 10);
// Tertiary Attributes
// a fish does not need to eat, for now
if (herbivore || carnivore)
edit.create(Hunger.class).set(0f, (size / 2f) + 2f);
}
示例6: execute
import com.artemis.EntityEdit; //导入方法依赖的package包/类
@Override
public void execute () {
EntityEdit editor = entity.edit();
editor.create(component);
}