當前位置: 首頁>>代碼示例>>Java>>正文


Java Entity.remove方法代碼示例

本文整理匯總了Java中localhost.iillyyaa2033.nmud.core.services.domain.world.Entity.remove方法的典型用法代碼示例。如果您正苦於以下問題:Java Entity.remove方法的具體用法?Java Entity.remove怎麽用?Java Entity.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在localhost.iillyyaa2033.nmud.core.services.domain.world.Entity的用法示例。


在下文中一共展示了Entity.remove方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: jump

import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //導入方法依賴的package包/類
@Override
public void jump(String entityId, String parentId, double[] position) {
	Entity child = getById(entityId);
	Entity oldpar = getParent(child);
	Entity newpar = getById(parentId);

	synchronized (child) {
		synchronized (oldpar) {
			oldpar.remove(child);
		}

		synchronized (newpar) {
			newpar.add(child);
		}
	}
}
 
開發者ID:nmud,項目名稱:nmud-core,代碼行數:17,代碼來源:Domain.java

示例2: pickUp

import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //導入方法依賴的package包/類
public void pickUp(Entity thing) {
	if (client.factory.isVisible(thing)) {
		// TODO: заменить на вызов одноименного метода с двумя параметрами
		if (creature.isAlive()) {
			Entity e = client.domain.getParent(thing);
			if (e != null) e.remove(thing);
			creature.parts.add(thing);
			thing.setPosition(new double[]{0d,0d});
			client.send("Взято: " + thing.toString());
			client.factory.notifyStateHasChanged();
		} else {
			client.send(AV_DEAD);
		}
	}
}
 
開發者ID:nmud,項目名稱:nmud-core,代碼行數:16,代碼來源:Avatar.java

示例3: 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


注:本文中的localhost.iillyyaa2033.nmud.core.services.domain.world.Entity.remove方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。