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


Java ComponentMapper类代码示例

本文整理汇总了Java中com.artemis.ComponentMapper的典型用法代码示例。如果您正苦于以下问题:Java ComponentMapper类的具体用法?Java ComponentMapper怎么用?Java ComponentMapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ComponentMapper类属于com.artemis包,在下文中一共展示了ComponentMapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ComponentMappers

import com.artemis.ComponentMapper; //导入依赖的package包/类
private ComponentMappers(final World world) {
	facing = ComponentMapper.getFor(FacingComponent.class, world);
	health = ComponentMapper.getFor(HealthComponent.class, world);
	position = ComponentMapper.getFor(PositionComponent.class, world);
	animation = ComponentMapper.getFor(AnimationComponent.class, world);
	facingAnimation = ComponentMapper.getFor(FacingAnimationComponent.class, world);
	sprite = ComponentMapper.getFor(SpriteComponent.class, world);
	name = ComponentMapper.getFor(NameComponent.class, world);
	highlight = ComponentMapper.getFor(HighlightAbleComponent.class, world);
	camera = ComponentMapper.getFor(CameraFollowComponent.class, world);
	collectible = ComponentMapper.getFor(CollectibleComponent.class, world);
	player = ComponentMapper.getFor(PlayerComponent.class, world);
	cursor = ComponentMapper.getFor(CursorComponent.class, world);
	turn = ComponentMapper.getFor(TurnComponent.class, world);
	ai = ComponentMapper.getFor(ArtificialIntelligenceComponent.class, world);
}
 
开发者ID:davidbecker,项目名称:taloonerrl,代码行数:17,代码来源:ComponentMappers.java

示例2: injectField

import com.artemis.ComponentMapper; //导入依赖的package包/类
@Override
protected boolean injectField (Object target, Field field, Class<?> type) throws ReflectiveOperationException {
	boolean alreadyInjected = super.injectField(target, field, type);
	if (alreadyInjected) return true;

	//artemis already handles injecting objects inside systems
	if (target instanceof BaseSystem) return false;

	if (BaseSystem.class.isAssignableFrom(type)) {
		field.setAccessible(true);
		field.set(target, engine != null ? engine.getSystem(type.asSubclass(BaseSystem.class)) : config.getSystem(type.asSubclass(BaseSystem.class)));
		return true;
	}

	if (ComponentMapper.class.isAssignableFrom(type)) {
		field.setAccessible(true);
		if (engine == null)
			delayedCompMapperToInject.add(new BiHolder<>(target, field));
		else
			injectComponentMapper(target, field);

		return true;
	}

	return false;
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:27,代码来源:SceneModuleContainer.java

示例3: initialize

import com.artemis.ComponentMapper; //导入依赖的package包/类
@Override
  public void initialize(){
      expiresMapper   = ComponentMapper.getFor(Expires.class, world);
      transformMapper = ComponentMapper.getFor(Transform.class, world);
      shooterMapper   = ComponentMapper.getFor(Shooter.class, world);
      playerMapper   	= ComponentMapper.getFor(Player.class, world);
      inputMapper   	= ComponentMapper.getFor(Input.class, world);

      Entity timeToLiveDisplay = EntityFactoryLD27.newTimeToLiveDisplay(world, 2, 0, 280, "");
      timeToLiveDisplay.addToWorld();
      timeToLiveDisplayComponent = timeToLiveDisplay.getComponent(TextComponent.class);
      KeyBindings.addKey(Keys.LEFT, "move_left");
KeyBindings.addKey(Keys.RIGHT, "move_right");
KeyBindings.addKey(Keys.UP, "move_up");
KeyBindings.addKey(Keys.DOWN, "move_down");

KeyBindings.addKey(Keys.Q, "move_left");
KeyBindings.addKey(Keys.D, "move_right");
KeyBindings.addKey(Keys.Z, "move_up");
KeyBindings.addKey(Keys.S, "move_down");
  }
 
开发者ID:akohen,项目名称:Merkurius-LD27,代码行数:22,代码来源:LD27PlayerSystem.java

示例4: getEntityAtMouse

import com.artemis.ComponentMapper; //导入依赖的package包/类
/**
 * Sandbox method for getting the entity under the mouse-pointer.
 *
 * @return entity under mousep-ointer
 */
public int getEntityAtMouse() {
    Vector2 mousePos = getMousePos();
    Tile t = getTile(Math.round(mousePos.x), Math.round(mousePos.y));
    if (t.getEntities().size == 0)
        return -1;
    IntSet.IntSetIterator iterator = t.getEntities().iterator();
    ComponentMapper<StatComponent> statMapper = arcadeWorld.getEntityWorld().getMapper(StatComponent.class);
    while (iterator.hasNext) {
        int entity = iterator.next();
        if (statMapper.has(entity))
            return entity;
    }
    return -1;
}
 
开发者ID:EtherWorks,项目名称:arcadelegends-gg,代码行数:20,代码来源:Character.java

示例5: initialize

import com.artemis.ComponentMapper; //导入依赖的package包/类
public void initialize(World world) {
	expiresMapper = ComponentMapper.getFor(Expires.class, world);
	parentMapper = ComponentMapper.getFor(Parent.class, world);
	actorMapper = ComponentMapper.getFor(Actor.class, world);
	
	this.world 	= world;
}
 
开发者ID:akohen,项目名称:Merkurius-LD27,代码行数:8,代码来源:BulletAction.java

示例6: initialize

import com.artemis.ComponentMapper; //导入依赖的package包/类
protected void initialize() {
	super.initialize();
	transformMapper = ComponentMapper.getFor(Transform.class, world);
       velocityMapper  = ComponentMapper.getFor(Velocity.class, world);
       shooterMapper   = ComponentMapper.getFor(Shooter.class, world);
       playerMapper   	= ComponentMapper.getFor(Player.class, world);
       parentMapper   	= ComponentMapper.getFor(Parent.class, world);
	inputMapper 	= ComponentMapper.getFor(Input.class, world);
       
       
       playerSystem	= Systems.get(PlayerSystem.class, world);
       if ( playerSystem == null ) {
		throw new RuntimeException("Required System not loaded");
	} 
}
 
开发者ID:akohen,项目名称:Merkurius-LD27,代码行数:16,代码来源:LD27SyncSystem.java

示例7: initialize

import com.artemis.ComponentMapper; //导入依赖的package包/类
@Override
public void initialize(){
    transformMapper = ComponentMapper.getFor(Transform.class, world);
    shooterMapper   = ComponentMapper.getFor(Shooter.class, world);
    playerMapper   	= ComponentMapper.getFor(Player.class, world);
    inputMapper   	= ComponentMapper.getFor(Input.class, world);
    refreshList();
}
 
开发者ID:akohen,项目名称:Merkurius-LD27,代码行数:9,代码来源:LD27ServerListSystem.java

示例8: initialize

import com.artemis.ComponentMapper; //导入依赖的package包/类
@Override
protected void initialize()
{
	rmap = new ComponentMapper<Renderable>(Renderable.class, this.world);
	amap = new ComponentMapper<Angle>(Angle.class, this.world);
	smap = new ComponentMapper<Size>(Size.class, this.world);
	pmap = new ComponentMapper<Position>(Position.class, this.world);
	
	camera = new Matrix4();
	camera.setToOrtho2D(0, 0, getInternalRes()[0], getInternalRes()[1]);
	camera.translate(getFOV()[0], getFOV()[1], 0);
}
 
开发者ID:nhydock,项目名称:gdx-artemis,代码行数:13,代码来源:RenderSystem2D.java

示例9: M

import com.artemis.ComponentMapper; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public M( Class<? extends Component> type, World world) {
	this.mapper = (ComponentMapper<A>) world.getMapper(type);
	isMirrorable = ClassReflection.isAssignableFrom(net.mostlyoriginal.api.component.common.Mirrorable.class, type);
}
 
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:6,代码来源:M.java

示例10: initialize

import com.artemis.ComponentMapper; //导入依赖的package包/类
public void initialize(World world) {
	expiresMapper = ComponentMapper.getFor(Expires.class, world);
	
	this.world 	= world;
}
 
开发者ID:akohen,项目名称:Merkurius-LD27,代码行数:6,代码来源:BulletClientAction.java

示例11: initialize

import com.artemis.ComponentMapper; //导入依赖的package包/类
@Override
public void initialize(){
    transformMapper = ComponentMapper.getFor(Transform.class, world);
    shooterMapper   = ComponentMapper.getFor(Shooter.class, world);
    velocityMapper  = ComponentMapper.getFor(Velocity.class, world);
}
 
开发者ID:akohen,项目名称:Merkurius-LD27,代码行数:7,代码来源:NpcSystem.java

示例12: initialize

import com.artemis.ComponentMapper; //导入依赖的package包/类
@Override
public void initialize() {
	inputMapper 	= ComponentMapper.getFor(Input.class, world);
	bodyMapper 	= ComponentMapper.getFor(PhysicsBodyComponent.class, world);
}
 
开发者ID:akohen,项目名称:Merkurius-LD27,代码行数:6,代码来源:LD27InputSystem.java

示例13: initialize

import com.artemis.ComponentMapper; //导入依赖的package包/类
@Override
protected void initialize() {
	transformMapper = ComponentMapper.getFor(Transform.class, world);
	velocityMapper 	= ComponentMapper.getFor(Velocity.class, world);
	bodyMapper 		= ComponentMapper.getFor(PhysicsBodyComponent.class, world);
}
 
开发者ID:akohen,项目名称:Merkurius-LD27,代码行数:7,代码来源:ScaledBox2DSystem.java

示例14: initialize

import com.artemis.ComponentMapper; //导入依赖的package包/类
@Override
public void initialize() {
	visualMapper 	= ComponentMapper.getFor(VisualComponent.class, world);
	velocityMapper 	= ComponentMapper.getFor(Velocity.class, world);
	shooterMapper 	= ComponentMapper.getFor(Shooter.class, world);
}
 
开发者ID:akohen,项目名称:Merkurius-LD27,代码行数:7,代码来源:LD27AnimationSystem.java

示例15: initialize

import com.artemis.ComponentMapper; //导入依赖的package包/类
@Override
public void initialize(){
	inputMap = new ComponentMapper<InputHandler>(InputHandler.class, this.world);
}
 
开发者ID:nhydock,项目名称:gdx-artemis,代码行数:5,代码来源:InputSystem.java


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