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


Java Human.isBuriednessDefined方法代碼示例

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


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

示例1: isValidHuman

import rescuecore2.standard.entities.Human; //導入方法依賴的package包/類
private boolean isValidHuman(StandardEntity entity) {
	if (entity == null)
		return false;
	if (!(entity instanceof Human))
		return false;

	Human target = (Human) entity;
	if (!target.isHPDefined() || target.getHP() == 0)
		return false;
	if (!target.isPositionDefined())
		return false;
	if (!target.isDamageDefined() || target.getDamage() == 0)
		return false;
	if (!target.isBuriednessDefined())
		return false;

	StandardEntity position = worldInfo.getPosition(target);
	if (position == null)
		return false;

	StandardEntityURN positionURN = position.getStandardURN();
	if (positionURN == REFUGE || positionURN == AMBULANCE_TEAM)
		return false;

	return true;
}
 
開發者ID:RCRS-ADF,項目名稱:sample,代碼行數:27,代碼來源:TestHumanDetector.java

示例2: isCommandCompleted

import rescuecore2.standard.entities.Human; //導入方法依賴的package包/類
private boolean isCommandCompleted() {
    Human agent = (Human) this.agentInfo.me();
    switch (this.type) {
        case ACTION_REST:
            if(this.target == null) {
                return (agent.getDamage() == 0);
            }
            if (Objects.requireNonNull(this.worldInfo.getEntity(this.target)).getStandardURN() == REFUGE) {
                if (agent.getPosition().getValue() == this.target.getValue()) {
                    return (agent.getDamage() == 0);
                }
            }
            return false;
        case ACTION_MOVE:
            return this.target == null || this.agentInfo.getPosition().getValue() == this.target.getValue();
        case ACTION_RESCUE:
            if(this.target == null) {
                return true;
            }
            Human human = (Human) Objects.requireNonNull(this.worldInfo.getEntity(this.target));
            return human.isBuriednessDefined() && human.getBuriedness() == 0 || (human.isHPDefined() && human.getHP() == 0);
        case ACTION_LOAD:
            if(this.target == null) {
                return true;
            }
            Human human1 = (Human) Objects.requireNonNull(this.worldInfo.getEntity(this.target));
            if((human1.isHPDefined() && human1.getHP() == 0)) {
                return true;
            }
            if(human1.getStandardURN() != CIVILIAN) {
                this.type = ACTION_RESCUE;
                return this.isCommandCompleted();
            }
            if (human1.isPositionDefined()) {
                EntityID position = human1.getPosition();
                if (this.worldInfo.getEntityIDsOfType(AMBULANCE_TEAM).contains(position)) {
                    return true;
                } else if (this.worldInfo.getEntity(position).getStandardURN() == REFUGE) {
                    return true;
                }
            }
            return false;
        case ACTION_UNLOAD:
            if(this.target != null) {
                StandardEntity entity = this.worldInfo.getEntity(this.target);
                if (entity != null && entity instanceof Area) {
                    if (this.target.getValue() != this.agentInfo.getPosition().getValue()) {
                        return false;
                    }
                }
            }
            return (this.agentInfo.someoneOnBoard() == null);
        case ACTION_AUTONOMY:
            if(this.target != null) {
                StandardEntity targetEntity = this.worldInfo.getEntity(this.target);
                if (targetEntity instanceof Area) {
                    this.type = this.agentInfo.someoneOnBoard() == null ? ACTION_MOVE : ACTION_UNLOAD;
                    return this.isCommandCompleted();
                }else if (targetEntity instanceof Human) {
                    Human h = (Human) targetEntity;
                    if((h.isHPDefined() && h.getHP() == 0)) {
                        return true;
                    }
                    this.type = h.getStandardURN() == CIVILIAN ? ACTION_LOAD : ACTION_RESCUE;
                    return this.isCommandCompleted();
                }
            }
            return true;
    }
    return true;
}
 
開發者ID:RCRS-ADF,項目名稱:sample,代碼行數:72,代碼來源:CommandExecutorAmbulance.java


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