public static EnumGameObject getEnumByValue(String value) { EnumGameObject[] enums = EnumGameObject.values(); int valuesNumber = enums.length; for (int i = 0; i < valuesNumber; i++) { EnumGameObject type = enums[i]; if (type.getValue().equals(value)) return type; } return NULL; }
public boolean isIn(EnumGameObject dir) { EnumGameObject current = EnumGameObject.getEnumByValue(this.value); while (!current.getValue().equals(current.getType())) { if (current == dir) { return true; } else { current = EnumGameObject.getEnumByType(current.getType()); } } if (current == dir) { return true; } return false; }