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


Java Entity.getPosition方法代码示例

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


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

示例1: setShape

import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //导入方法依赖的package包/类
private void setShape(Entity entity, double[] offset, double rot) {
		deepness = new int[]{
			(int)offset[2] - (int) entity.getPosition()[2] + entity.getDeepnessMin(),
			(int)offset[2] - (int) entity.getPosition()[2] + entity.getDeepnessMax()};

//		Log.d("runt", entity + " " + Utils.ats(deepness));

		/*	double[] noffs = Arrays.copyOf(offset, 3);
		 if (isChild) noffs = ShapeHelper.rotate(entity.getPosition(), offset, rot, Entity.COORDS_COUNT_POSITION);
		 double[] shape = ShapeHelper.rotate(entity.getShape(), noffs, rot, Entity.COORDS_COUNT_SHAPE);
		 */
		shape = entity.getShape(offset);

		if (shape.length < Entity.COORDS_COUNT_SHAPE) {
			shape = Arrays.copyOf(shape, Entity.COORDS_COUNT_SHAPE);
		}
	}
 
开发者ID:nmud,项目名称:nmud,代码行数:18,代码来源:DrawingEntity.java

示例2: getExitCoords

import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //导入方法依赖的package包/类
private double[] getExitCoords(int index, Entity entity) {
	double[] rz = domains[index].getGlobalPositonOf(entity.getId());

	try {
		rz[0] += (Double.parseDouble(entity.getParam("exitPointX")) - entity
				.getPosition()[0]);
		rz[1] += (Double.parseDouble(entity.getParam("exitPointY")) - entity
				.getPosition()[1]);

		if (entity.hasParam("exitPointZ")) {
			rz[2] += (Double.parseDouble(entity.getParam("exitPointZ")) - entity
					.getPosition()[2]);
		}
	} catch (Exception e) {
		e(e);
	}
	return rz;
}
 
开发者ID:nmud,项目名称:nmud-core,代码行数:19,代码来源:AI.java

示例3: getGlobalPositonOf

import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //导入方法依赖的package包/类
@Override
public double[] getGlobalPositonOf(String entityId) {
	double[] rz = null;

	Entity e = getById(entityId);

	if (e != null) {
		rz = e.getPosition();
		Entity parent;

		while (!((parent = getParent(e)) instanceof DomainEntity)) {
			offsetArray(rz, parent.getPosition());
			e = parent;
		}
		offsetArray(rz, parent.getPosition());
	}

	return rz;
}
 
开发者ID:nmud,项目名称:nmud-core,代码行数:20,代码来源:Domain.java

示例4: recursiveMoveUp

import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //导入方法依赖的package包/类
private Entity recursiveMoveUp(Entity child, double[] np, double x, double y, int z) {
	double[] pos = child.getPosition();
	x += pos[0];
	y += pos[1];
	z += pos[2];

	Entity parent = getParent(child);
	if (parent != null) {
		if (parent instanceof DomainEntity) {
			// У DomainEntity нет формы, поэтому она - родитель в любом случае
			np[0] = x;
			np[1] = y;
			np[2] = z;
			return parent;
		} else if (parent.isInside(x, y, (int)(z - pos[2]))) {
			np[0] = x;
			np[1] = y;
			np[2] = z;
			return parent;
		} else {
			return recursiveMoveUp(parent, np, x, y, z);
		}
	} else {
		return child;
	}
}
 
开发者ID:nmud,项目名称:nmud-core,代码行数:27,代码来源:Domain.java

示例5: positionToString

import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //导入方法依赖的package包/类
static String positionToString(Entity e) {
	String result = "";
	double[] position = e.getPosition();
	result += position[0] + ":" + position[1] + 
		(position.length > 2 ? ":" + position[2] : "");

	return result;
}
 
开发者ID:nmud,项目名称:nmud-core,代码行数:9,代码来源:DomainUtils.java

示例6: recursivePhysics

import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //导入方法依赖的package包/类
void recursivePhysics(DomainIntf d, Entity e){
	double[] newPos = e.getPosition();
	
	if(d.getParent(e).isInside(newPos[0],newPos[1],(int) newPos[2])){
		d.move(e.getId(),newPos);
	} else {
		d.notifyEntity(e.getId(),32);
	}
}
 
开发者ID:nmud,项目名称:nmud-core,代码行数:10,代码来源:Physics.java

示例7: move

import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //导入方法依赖的package包/类
private void move(Entity e, double[] targetPosition) {
//		d("Moving to " + Utils.ats(targetPosition));

		double[] newPosition = e.getPosition();
		Entity parent = getParent(e);

		if (parent != null) {

			Entity top;
			if (!(parent instanceof DomainEntity)) {
				top = recursiveMoveUp(parent, newPosition, targetPosition[0], targetPosition[1], (int) targetPosition[2]);

				if (top == null)
					top = parent;
			} else {
				top = parent;
			}

//			d("Top is " + top + " New position: " + Utils.ats(newPosition));

			Entity bottom = recursiveMoveDown(top, newPosition, newPosition[0], newPosition[1], (int)newPosition[2], false);
			if (e == bottom)
				bottom = null;
//			d("Bottom is " + bottom + " New position: " + Utils.ats(newPosition));

			if (bottom != null) {
				while (!(bottom instanceof ContainerEntity)) {
					bottom = getParent(bottom);
				}
			}

			parent.remove(e);
			parent.notifyChildCreaturesAboutStateChanged();
			e.setPosition(newPosition);

			if (bottom != null) {
				bottom.add(e);
				bottom.notifyChildCreaturesAboutStateChanged();
			} else {
				top.add(e);
				top.notifyChildCreaturesAboutStateChanged();
			}
		} else {
			d("No parent found");
		}
	}
 
开发者ID:nmud,项目名称:nmud-core,代码行数:47,代码来源:Domain.java

示例8: dephrangeToString

import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //导入方法依赖的package包/类
private static String dephrangeToString(Entity entity) {
	return (int)(entity.getDeepnessMin() - entity.getPosition()[2]) + " " + (int)(entity.getDeepnessMax() - entity.getPosition()[2]);
}
 
开发者ID:nmud,项目名称:nmud-core,代码行数:4,代码来源:DomainUtils.java


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