本文整理汇总了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);
}
示例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;
}
示例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");
}
示例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;
}
示例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;
}
示例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");
}
}
示例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();
}
示例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);
}
示例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);
}
示例10: initialize
import com.artemis.ComponentMapper; //导入依赖的package包/类
public void initialize(World world) {
expiresMapper = ComponentMapper.getFor(Expires.class, world);
this.world = world;
}
示例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);
}
示例12: initialize
import com.artemis.ComponentMapper; //导入依赖的package包/类
@Override
public void initialize() {
inputMapper = ComponentMapper.getFor(Input.class, world);
bodyMapper = ComponentMapper.getFor(PhysicsBodyComponent.class, world);
}
示例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);
}
示例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);
}
示例15: initialize
import com.artemis.ComponentMapper; //导入依赖的package包/类
@Override
public void initialize(){
inputMap = new ComponentMapper<InputHandler>(InputHandler.class, this.world);
}