• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java EntityBuilder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: createEntity_Projectile

import com.artemis.utils.EntityBuilder; //导入依赖的package包/类
public static Entity createEntity_Projectile(int levelID, float posX, float posY) {
	EntityBuilder ent = getTemplate_Common(levelID, posX, posY);
	
	EntityData data = new EntityData(EnumEntityType.PROJECTILE);
	data.aiControlled = true;
	data.sizeDiameter = Cst.COLLIDESIZE_PROJECTILE;
	
	ProfileData profile = new ProfileData();
	
	ent
	.with(new Health(1))
	.with(new RenderData("prj_energyblast"))
	.with(data)
	.with(profile)
	.with(new ProjectileData())
	;
	
	Game_AI_TestBed.instance().getLevel(levelID).addToEntityCount(1);
	
	return ent.build();
}
 
开发者ID:Corosauce,项目名称:AI_TestBed_v3,代码行数:22,代码来源:EntityFactory.java


示例2: createIndestructible

import com.artemis.utils.EntityBuilder; //导入依赖的package包/类
public void createIndestructible(float x, float y, TextureAtlas tileTextureAtlas) {
    BodyDef bodyDef = new BodyDef();
    bodyDef.type = BodyDef.BodyType.StaticBody;
    bodyDef.position.set(x, y);

    Body body = b2dWorld.createBody(bodyDef);
    PolygonShape polygonShape = new PolygonShape();
    polygonShape.setAsBox(0.5f, 0.5f);
    FixtureDef fixtureDef = new FixtureDef();
    fixtureDef.shape = polygonShape;
    fixtureDef.filter.categoryBits = GameManager.INDESTRUCTIIBLE_BIT;
    fixtureDef.filter.maskBits = GameManager.PLAYER_BIT | GameManager.ENEMY_BIT | GameManager.BOMB_BIT;
    body.createFixture(fixtureDef);

    polygonShape.dispose();

    Renderer renderer = new Renderer(new TextureRegion(tileTextureAtlas.findRegion("indestructible"), 0, 0, 16, 16), 16 / GameManager.PPM, 16 / GameManager.PPM);
    renderer.setOrigin(16 / GameManager.PPM / 2, 16 / GameManager.PPM / 2);

    new EntityBuilder(world)
            .with(
                    new Transform(x, y, 1f, 1f, 0),
                    renderer
            )
            .build();
}
 
开发者ID:yichen0831,项目名称:Bomberman_libGdx,代码行数:27,代码来源:ActorBuilder.java


示例3: spawnPointer

import com.artemis.utils.EntityBuilder; //导入依赖的package包/类
private void spawnPointer(int x, int y, int angle, Ingredient.Type type, boolean inverted) {
		int i =angle+90;
		vector2 = v2.set(0, -G.TILE_SIZE - 3).setAngle(i);

		new EntityBuilder(world).with(
				new Pos(x + 3 + vector2.x, y + 6  + vector2.y),
				new Angle(i-90+(inverted?-180:0), 7, 5),
				new Anim("pointer"),
				new Color(1f,1f,1f,0.6f),
				new Renderable(LAYER_CONVEYER + 1)
		).build();

//		for (i =0; i>-360; i--) {
			vector2 = v2.set(-15, -G.TILE_SIZE + 4).setAngle(i);

		final String id = "ingredient-" + type.name();
		final Animation animation = abstractAssetSystem.get(id);
		final TextureRegion region = animation.getKeyFrames()[0];
		new EntityBuilder(world).with(
					new Pos(x + vector2.x + 10 - region.getRegionWidth()/2, y + 10 + vector2.y - region.getRegionHeight()/2),
					new Color(1f, 1f, 1f, 0.8f),
					new Anim(id),
					new Renderable(LAYER_CONVEYER + 2)
			).build();
		//}
	}
 
开发者ID:DaanVanYperen,项目名称:odb-minion-factorium,代码行数:27,代码来源:GameScreenSetupSystem.java


示例4: initialize

import com.artemis.utils.EntityBuilder; //导入依赖的package包/类
@Override
protected void initialize() {
	super.initialize();

	OdbFeatureComponent features = new OdbFeatureComponent();
	new EntityBuilder(world).with(features).tag(FEATURES_TAG).build();

	// detect packing based on reflection.
	features.isPacked = isPackedWeavingEnabled();
	features.isPooled = isPooledWeavingEnabled();
	features.isHotspotOptimization = isHotspotOptimizationEnabled();
	features.isFactory = isFactoryCreationEnabled();

	debugFeature("Struct Emulation ...... ", features.isPacked);
	debugFeature("Pooling ............... ", features.isPooled);
	debugFeature("Hotspot Optimization .. ", features.isHotspotOptimization);
	debugFeature("Factory ............... ", features.isFactory);
}
 
开发者ID:DaanVanYperen,项目名称:odb-minion-factorium,代码行数:19,代码来源:OdbFeatureDetectionSystem.java


示例5: createDraggingIndicator

import com.artemis.utils.EntityBuilder; //导入依赖的package包/类
private void createDraggingIndicator(Entity draggable) {
	final Anim sourceAnim = mAnim.get(draggable);
	final Pos sourcePos = mPos.get(draggable);
	final Bounds sourceBounds = mBounds.get(draggable);

	final Anim anim = new Anim();
	anim.id = sourceAnim.id;
	anim.speed = sourceAnim.speed;
	anim.age = sourceAnim.age;

	final Pos pos = new Pos();
	pos.x = sourcePos.x;
	pos.y = sourcePos.y;


	NO_ANGLE = new Angle(0);
	new EntityBuilder(world)
			.with(new Dragging(draggable), new Renderable(GameScreenSetupSystem.LAYER_DRAGGING),
					new Bounds(sourceBounds.minx, sourceBounds.miny, sourceBounds.maxx, sourceBounds.maxy),
					anim, pos, new Angle(mAngle.getSafe(draggable, NO_ANGLE).rotation), new Color(1f, 1f, 1f, 0.5f)
			).build();
}
 
开发者ID:DaanVanYperen,项目名称:odb-minion-factorium,代码行数:23,代码来源:DragStartSystem.java


示例6: createComponent

import com.artemis.utils.EntityBuilder; //导入依赖的package包/类
/**
 * attempts to create a component at coordinates. will fail if out of bounds or already one there.
 */
public Entity createComponent(int gridX, int gridY, ShipComponent.Type type, ShipComponent.State state) {
    if (gridY < 0 || gridX < 0 || gridX >= MAX_X || gridY >= MAX_Y) return null;
    if (get(gridX, gridY) == null) {
        Entity entity = new EntityBuilder(world).with(
                new Pos(),
                new Anim(),
                new Renderable(),
                new ShipComponent(type, gridX, gridY, ShipComponent.State.UNDER_CONSTRUCTION),
                new Bounds(0, 0, 8, 8),
                new Clickable()).build();
        set(gridX, gridY, entity);

        if (state == ShipComponent.State.CONSTRUCTED) {
            constructionSystem.complete(entity);
        }
        return entity;
    }
    return null;
}
 
开发者ID:DaanVanYperen,项目名称:arktrail,代码行数:23,代码来源:ShipComponentSystem.java


示例7: createConstructionButtons

import com.artemis.utils.EntityBuilder; //导入依赖的package包/类
private void createConstructionButtons() {
    int index = 0;
    for (ShipComponent.Type structure : ShipComponent.Type.values()) {
        if (structure.buildable) {
            int x = G.SCREEN_WIDTH + MARGIN_RIGHT - (index + 1) * 18;
            int y = 7;
            final Entity button = efs.createButton(x, y, 15, 15, "btn-construct", new ToolSelectButton(structure), null);
            constructionButton.put(structure, button);
            Button button1 = mButton.get(button);
            button1.color = Color.WHITE;
            button1.hint = structure.label;
            button1.hideIfDisabled  =true;
            button1.transientIcon = new SafeEntityReference(new EntityBuilder(world).with(
                    new Pos(x + 4, y + 5),
                    new Anim(structure.animId),
                    new Renderable(4000)).build());
            // add icon over button. @todo merge with button logic.

            index++;
        }
    }
}
 
开发者ID:DaanVanYperen,项目名称:arktrail,代码行数:23,代码来源:ConstructionSystem.java


示例8: create

import com.artemis.utils.EntityBuilder; //导入依赖的package包/类
@Override public void create () {
	camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
	camera.setToOrtho(false);
	camera.update();
	renderer = new ShapeRenderer();

	WorldConfiguration config = new WorldConfigurationBuilder()
		.with(new GodSystem())
		.with(new QuadTreeSystem())
		.build();
	config.register(camera).register(renderer);
	world = new World(config);

	for (int i = 0; i < 10000; i++) {
		new EntityBuilder(world).with(
			new Position(MathUtils.random(Gdx.graphics.getWidth() - 25), MathUtils.random(Gdx.graphics.getHeight() - 25)),
			new Velocity(MathUtils.random(-50, 50), MathUtils.random(-50, 50)),
			new Bounds(MathUtils.random(3, 15), MathUtils.random(3, 15))
		).build();
	}
}
 
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:22,代码来源:QuadTreeIntegrationTest.java


示例9: DeferredSystem_EntityAdded_RegisteredWithPrincipal

import com.artemis.utils.EntityBuilder; //导入依赖的package包/类
@Test
public void DeferredSystem_EntityAdded_RegisteredWithPrincipal() {

	EntityProcessPrincipal principal = mock(EntityProcessPrincipal.class);

	final WorldConfiguration config = new WorldConfiguration();
	config.setSystem(new TestDeferredSystem(Aspect.all(EmptyComponent.class), principal));
	// setup world and single entity.
	World w = new World(config);

	Entity myEntity = new EntityBuilder(w).with(EmptyComponent.class).build();
	w.process();

	// ensure it gets registered with the principal
	verify(principal, times(1)).registerAgent(eq(myEntity.getId()), any(EntityProcessAgent.class));
}
 
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:17,代码来源:DeferredEntityProcessingSystemTest.java


示例10: DeferredSystem_EntityRemoved_UnregisteredFromPrincipal

import com.artemis.utils.EntityBuilder; //导入依赖的package包/类
@Test
public void DeferredSystem_EntityRemoved_UnregisteredFromPrincipal() {

	EntityProcessPrincipal principal = mock(EntityProcessPrincipal.class);

	// setup world and single entity.
	WorldConfiguration config = new WorldConfiguration();
	config.setSystem(new TestDeferredSystem(Aspect.all(EmptyComponent.class), principal));
	World w = new World(config);
	Entity myEntity = new EntityBuilder(w).with(EmptyComponent.class).build();
	w.process();
	w.deleteEntity(myEntity);
	w.process();

	// ensure it gets registered with the principal
	verify(principal, times(1)).unregisterAgent(eq(myEntity.getId()), any(EntityProcessAgent.class));
}
 
开发者ID:DaanVanYperen,项目名称:artemis-odb-contrib,代码行数:18,代码来源:DeferredEntityProcessingSystemTest.java


示例11: processDropPayload

import com.artemis.utils.EntityBuilder; //导入依赖的package包/类
@Override
public Entity processDropPayload (EntityEngine entityEngine, EditorScene scene, Object payload) {

	if (payload instanceof SpriterAsset) {
		SpriterAsset asset = (SpriterAsset) payload;

		float scale = 1f / scene.pixelsPerUnit;

		return new EntityBuilder(entityEngine)
				.with(spriterCache.createComponent(asset, scale), new SpriterProperties(scale), new Transform(),
						new AssetReference(asset),
						new Renderable(0), new Layer(scene.getActiveLayerId()),
						new ExporterDropsComponent(SpriterProperties.class))
				.build();

	}

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


示例12: processDropPayload

import com.artemis.utils.EntityBuilder; //导入依赖的package包/类
@Override
public Entity processDropPayload (EntityEngine engine, EditorScene scene, Object payload) {

	if (payload instanceof SpineAssetDescriptor) {
		SpineAssetDescriptor asset = (SpineAssetDescriptor) payload;

		return new EntityBuilder(engine)
				.with(new VisSpine(spineCache.get(asset)), new SpinePreview(), new SpineScale(1f / scene.pixelsPerUnit), new SpineBounds(),
						new AssetReference(asset), new Transform(), new Tint(),
						new Renderable(0), new Layer(scene.getActiveLayerId()),
						new ExporterDropsComponent(SpinePreview.class, SpineScale.class, SpineBounds.class))
				.build();
	}

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


示例13: createEntity_Player

import com.artemis.utils.EntityBuilder; //导入依赖的package包/类
public static Entity createEntity_Player(int levelID, float posX, float posY) {
	EntityBuilder ent = getTemplate_Common(levelID, posX, posY);
	
	EntityData data = new EntityData(EnumEntityType.SPRITE);
	data.aiControlled = false;
	data.inputControlled = true;
	data.setTeam(EntityData.TEAM_PLAYER);
	data.sizeDiameter = Cst.COLLIDESIZE_SPRITE;
	
	ProfileData profile = new ProfileData();
	profile.addAction(new ActionRoutineDodge(3));
	
	RenderData render = new RenderData("player");
	
	WeaponData weaponData = new WeaponData();
	WeaponLocation loc = new WeaponLocation();
	Weapon weap = new Weapon();
	
	weap.ticksCooldownRate = 3;
	
	loc.listWeapons.add(weap);
	weaponData.listWeaponLocations.add(loc);
	
	ent
	.with(new PlayerData())
	.with(data)
	.with(weaponData)
	.with(profile)
	.with(render)
	;
	
	Game_AI_TestBed.instance().getLevel(levelID).addToEntityCount(1);
	
	return ent.build();
}
 
开发者ID:Corosauce,项目名称:AI_TestBed_v3,代码行数:36,代码来源:EntityFactory.java


示例14: createEntity_NPC

import com.artemis.utils.EntityBuilder; //导入依赖的package包/类
public static Entity createEntity_NPC(int levelID, float posX, float posY) {
	EntityBuilder ent = getTemplate_Common(levelID, posX, posY);
	
	EntityData data = new EntityData(EnumEntityType.SPRITE);
	data.aiControlled = true;
	data.sizeDiameter = Cst.COLLIDESIZE_SPRITE;
	
	ProfileData profile = new ProfileData();
	
	WeaponData weaponData = new WeaponData();
	WeaponLocation loc = new WeaponLocation();
	Weapon weap = new Weapon();
	
	loc.listWeapons.add(weap);
	weaponData.listWeaponLocations.add(loc);
	
	ent
	.with(new Health(100))
	.with(new RenderData())
	.with(data)
	.with(weaponData)
	.with(profile)
	;
	
	Game_AI_TestBed.instance().getLevel(levelID).addToEntityCount(1);
	
	return ent.build();
}
 
开发者ID:Corosauce,项目名称:AI_TestBed_v3,代码行数:29,代码来源:EntityFactory.java


示例15: getTemplate_Common

import com.artemis.utils.EntityBuilder; //导入依赖的package包/类
public static EntityBuilder getTemplate_Common(int levelID, float posX, float posY) {
	EntityBuilder ent = new EntityBuilder(Game_AI_TestBed.instance().getLevel(levelID).getWorld())
	.with(new Position(posX, posY))
	.with(new Velocity())
	.with(new PhysicsData())
	.with(new Health(100))
	.with(new RenderData())
	;
	return ent;
}
 
开发者ID:Corosauce,项目名称:AI_TestBed_v3,代码行数:11,代码来源:EntityFactory.java


示例16: getMetadata

import com.artemis.utils.EntityBuilder; //导入依赖的package包/类
public MapMetadata getMetadata()
{
	Entity entity = tagManager.getEntity(MAP_METADATA);
	if ( entity == null )
	{
		entity = new EntityBuilder(world).with(new MapMetadata()).tag(MAP_METADATA).build();
	}
	return mMapMetadata.get(entity);
}
 
开发者ID:DaanVanYperen,项目名称:ns2-scc-profiler,代码行数:10,代码来源:MapMetadataManager.java


示例17: writeLabel

import com.artemis.utils.EntityBuilder; //导入依赖的package包/类
private void writeLabel(RenderMask.Mask mask, String title, int scale, int x, int y) {
    Label font = new Label(title);
    font.scale = scale;
    new EntityBuilder(world).with(
            new Renderable(1000),
            new net.mostlyoriginal.api.component.graphics.Color(0f,0f,0f,1f),
            new RenderMask(mask),
            new Pos(x, y),
            font)
            .build();
}
 
开发者ID:DaanVanYperen,项目名称:ns2-scc-profiler,代码行数:12,代码来源:EntityFactoryManager.java


示例18: createBasicButton

import com.artemis.utils.EntityBuilder; //导入依赖的package包/类
public Entity createBasicButton(String animId, int x, ButtonListener buttonListener, int y) {
    Anim anim = new Anim(animId);
    anim.scale = 2;
    return new EntityBuilder(world)
            .with(
                    new Pos(x, y),
                    new Bounds(32,32),
                    anim,
                    new Clickable(),
                    new Renderable(800),
                    new Button(animId,animId, animId, buttonListener)).build();
}
 
开发者ID:DaanVanYperen,项目名称:ns2-scc-profiler,代码行数:13,代码来源:EntityFactoryManager.java


示例19: drawBubble

import com.artemis.utils.EntityBuilder; //导入依赖的package包/类
/**
 * /** Render lined bubble in pixmap space.
 *  @param color
 * @param text
 * @param x1         line origin
 * @param y1         line origin
 * @param x2         line end (where bubble will be)
 * @param y2         line end (where bubble will be)
 * @param pixmap     pixmap to render to.
 * @param renderMask render mask for label.
 * @param distanceIndicator
 */
public void drawBubble(Color color, String text, int x1, int y1, int x2, int y2, Pixmap pixmap, RenderMask renderMask, DistanceIndicator distanceIndicator) {

	pixmap.setColor(color);
	pixmap.drawLine(
			x1, pixmap.getHeight() - y1,
			x2, pixmap.getHeight() - y2);

	tmpCol.set(color).a = 1f;
	pixmap.setColor(tmpCol);
	pixmap.fillRectangle(x2 - 6, pixmap.getHeight() - y2 - 4, 11, 8);

	// label is in screen space.
	Label label = new Label(text);
	label.scale = 2;
	label.align = Label.Align.CENTER;
	Entity e = new EntityBuilder(world).with(
			new Renderable(1000),
			new Transient(),
			new net.mostlyoriginal.api.component.graphics.Color(1f, 1f, 1f, 1f),
			renderMask,
			new Input(1, 2),
			new Bounds(0, 0, 11, 8),
			new Clickable(),
			new Pos((int) (x2 * LayerManager.CELL_SIZE), (int) (y2 * LayerManager.CELL_SIZE)),
			label)
			.build();
	if ( distanceIndicator != null ) {
		e.edit().add(distanceIndicator);
	}
}
 
开发者ID:DaanVanYperen,项目名称:ns2-scc-profiler,代码行数:43,代码来源:RoutePlotSystem.java


示例20: initialize

import com.artemis.utils.EntityBuilder; //导入依赖的package包/类
@Override
protected void initialize() {
	Anim refresh = new Anim("refresh");
	refresh.scale = 5;
	refreshIndicator = new EntityBuilder(world).with(new Pos(0, G.CANVAS_HEIGHT-120), new Color(1f,1f,1f,0.5f), new Angle(0,40,40), refresh, new Renderable(4000)).build();
	setPrerequisiteSystems(preferredRouteCalculationSystem);
}
 
开发者ID:DaanVanYperen,项目名称:ns2-scc-profiler,代码行数:8,代码来源:RefreshHandlerSystem.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ConnectionCache类代码示例发布时间:2022-05-22
下一篇:
Java SubjectPublicKeyInfoFactory类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap