当前位置: 首页>>代码示例>>Java>>正文


Java EntityEdit.add方法代码示例

本文整理汇总了Java中com.artemis.EntityEdit.add方法的典型用法代码示例。如果您正苦于以下问题:Java EntityEdit.add方法的具体用法?Java EntityEdit.add怎么用?Java EntityEdit.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.artemis.EntityEdit的用法示例。


在下文中一共展示了EntityEdit.add方法的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);
}
 
开发者ID:fabio-t,项目名称:alone-rl,代码行数:26,代码来源:DeadSystem.java

示例2: createArmy

import com.artemis.EntityEdit; //导入方法依赖的package包/类
public static Entity createArmy(World world, MapPosition pos, String name, Empire empire, Entity source,
    int militaryPower) {
  Entity e = world.createEntity();
  EntityEdit edit = e.edit();

  edit.add(new Counter(Colors.contrast(empire.color), empire.color, militaryPower));

  edit.add(pos).add(new Name(name)).add(new Description(name))
      .add(new Destination(source.getComponent(ArmyCommand.class).forbiddenTiles, 1))
      .add(new Army(source, militaryPower)).add(empire);

  if (empire.isComputerControlled())
    edit.add(new AIControlled());

  return e;
}
 
开发者ID:guillaume-alvarez,项目名称:ShapeOfThingsThatWere,代码行数:17,代码来源:EntityFactory.java

示例3: makeItem

import com.artemis.EntityEdit; //导入方法依赖的package包/类
public int makeItem(final String tag)
{
    final ItemTemplate template = templates.get(tag);

    if (template == null)
    {
        log.warn("Item named {} doesn't exist", tag);
        return -1;
    }

    final int id = world.create();

    final EntityEdit edit = world.edit(id);

    edit.add(new Name(template.name, tag));

    // TODO find a way to do this dynamically. Right now I cannot figure out a way
    // of deserialising an array of Components, because it's an abstract class that I cannot annotate.
    if (template.wearable != null)
        edit.add(template.wearable);
    if (template.weapon != null)
        edit.add(template.weapon);
    if (template.sprite != null)
        edit.add(template.sprite);
    if (template.obstacle != null)
        edit.add(template.obstacle);
    if (template.crushable != null)
        edit.add(template.crushable);
    if (template.cuttable != null)
        edit.add(template.cuttable);

    return id;
}
 
开发者ID:fabio-t,项目名称:alone-rl,代码行数:34,代码来源:ItemSystem.java

示例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;
}
 
开发者ID:guillaume-alvarez,项目名称:ShapeOfThingsThatWere,代码行数:29,代码来源:EntityFactory.java

示例5: createEmpire

import com.artemis.EntityEdit; //导入方法依赖的package包/类
public static Entity createEmpire(World world, int x, int y, String name, Empire empire) {
  Entity e = world.createEntity();

  EntityEdit edit = e.edit();

  ArmyCommand command = new ArmyCommand();
  edit.add(empire).add(new EventsCount()).add(new Discoveries()).add(new Policies()).add(new Diplomacy())
      .add(command).add(new Score());

  Sprite sprite = new Sprite();
  sprite.name = "cylinderwide";
  sprite.rotation = 0f;
  sprite.scaleX = 1f;
  sprite.scaleY = 1f;
  sprite.color = empire.color;
  edit.add(sprite);

  InfluenceSource source = new InfluenceSource();
  edit.add(new MapPosition(x, y)).add(source).add(new Destination(command.forbiddenTiles, 2));

  edit.add(new Name(name)).add(new Description("Tribe of " + name))
      .add(new TextBox(() -> name + ": " + source.power()));

  if (empire.isComputerControlled())
    edit.add(new AIControlled());

  return e;
}
 
开发者ID:guillaume-alvarez,项目名称:ShapeOfThingsThatWere,代码行数:29,代码来源:EntityFactory.java

示例6: execute

import com.artemis.EntityEdit; //导入方法依赖的package包/类
@Override
public void execute () {
	EntityEdit editor = entity.edit();
	if (add)
		editor.add(component);
	else
		editor.remove(component);
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:9,代码来源:VisComponentManipulator.java


注:本文中的com.artemis.EntityEdit.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。