本文整理汇总了Java中com.badlogic.gdx.utils.ObjectSet.iterator方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectSet.iterator方法的具体用法?Java ObjectSet.iterator怎么用?Java ObjectSet.iterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.utils.ObjectSet
的用法示例。
在下文中一共展示了ObjectSet.iterator方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleStealth
import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
@Override
protected void handleStealth() {
super.handleStealth();
if (isSneaking() && !isInvisible()) {
ObjectSet<AbstractGameCharacter> characters = new ObjectSet<AbstractGameCharacter>();
getMap().getAllObjectsInArea(characters, getVisibleArea(), AbstractGameCharacter.class);
Iterator<AbstractGameCharacter> iterator = characters.iterator();
while (iterator.hasNext()) {
AbstractGameCharacter character = iterator.next();
if (this.getFaction().equals(character.getFaction()) || character.getLineOfSight() == null) {
iterator.remove();
continue;
}
if (character.getViewConeArea().contains((int)position.getX(), (int)position.getY())) {
setIsSneaking(false);
Log.logLocalized("detectedBy", LogType.CHARACTER, getName(), character.getName());
}
if (!isSneaking()) {
return;
}
}
if (characters.size > 0) {
--s_tilesTillStealthCheck;
if (s_tilesTillStealthCheck < 1) {
if (!stats.rollSkillCheck(Skill.SNEAKING, getMap())) {
Log.logLocalized("detectedBy", LogType.CHARACTER, getName(), characters.iterator().next().getName());
setIsSneaking(false);
} else {
s_tilesTillStealthCheck = Configuration.getTilesPerStealthCheck() + stats.skills().getSkillRank(Skill.SNEAKING);
}
}
} else {
s_tilesTillStealthCheck = Configuration.getTilesPerStealthCheck() + stats.skills().getSkillRank(Skill.SNEAKING);
}
}
}
示例2: getAllCharactersInArea
import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
/**
* Returns an array of all characters in the supplied area that fulfill the supplied filters requirements.
*
* @param returnValue - the set into which to store the result. Can be null. In that case, only true / false will be returned
* indicating whether any characters were found
* @param filters - an array of filters that the characters must fulfill. Can be empty.
* @return true if any characters were found, false otherwise
*/
private boolean getAllCharactersInArea(ObjectSet<AbstractGameCharacter> returnValue, PositionArray area, CharacterFilter... filters) {
if (area == null) {
return false;
}
if (returnValue == null) {
tempSet.clear();
}
ObjectSet<AbstractGameCharacter> setToUse = returnValue != null ? returnValue : tempSet;
if (!getMap().getAllObjectsInArea(setToUse, area, AbstractGameCharacter.class)) {
return false;
}
setToUse.remove(this);
if (filters.length > 0) {
Iterator<AbstractGameCharacter> iterator = setToUse.iterator();
while (iterator.hasNext()) {
AbstractGameCharacter go = iterator.next();
for (CharacterFilter filter : filters) {
if (filter.shouldFilter(this, go)) {
iterator.remove();
break;
}
}
}
}
return setToUse.size > 0;
}
示例3: invokeMessageListeners
import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
/** @param listeners their message was just posted, so they will be invoked. */
protected static void invokeMessageListeners(final ObjectSet<MessageListener> listeners) {
for (final Iterator<MessageListener> iterator = listeners.iterator(); iterator.hasNext();) {
final MessageListener listener = iterator.next();
if (!listener.processMessage()) {
iterator.remove();
}
}
}
示例4: invokeEventListeners
import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
/** @param event was just posted.
* @param listeners will be invoked. */
@SuppressWarnings({ "rawtypes", "unchecked" }) // Types are always correct.
protected static void invokeEventListeners(final Object event, final ObjectSet<EventListener<?>> listeners) {
for (final Iterator<EventListener<?>> iterator = listeners.iterator(); iterator.hasNext();) {
final EventListener listener = iterator.next();
if (!listener.processEvent(event)) {
iterator.remove();
}
}
}