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


Python entity.Entity方法代码示例

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


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

示例1: get_game_variables

# 需要导入模块: import entity [as 别名]
# 或者: from entity import Entity [as 别名]
def get_game_variables(constants):
    fighter_component = Fighter(hp=100, defense=1, power=2)
    inventory_component = Inventory(26)
    level_component = Level()
    equipment_component = Equipment()
    player = Entity(0, 0, '@', libtcod.white, 'Player', blocks=True, render_order=RenderOrder.ACTOR,
                    fighter=fighter_component, inventory=inventory_component, level=level_component,
                    equipment=equipment_component)
    entities = [player]

    equippable_component = Equippable(EquipmentSlots.MAIN_HAND, power_bonus=2)
    dagger = Entity(0, 0, '-', libtcod.sky, 'Dagger', equippable=equippable_component)
    player.inventory.add_item(dagger)
    player.equipment.toggle_equip(dagger)

    game_map = GameMap(constants['map_width'], constants['map_height'])
    game_map.make_map(constants['max_rooms'], constants['room_min_size'], constants['room_max_size'],
                      constants['map_width'], constants['map_height'], player, entities)

    message_log = MessageLog(constants['message_x'], constants['message_width'], constants['message_height'])

    game_state = GameStates.PLAYERS_TURN

    return player, entities, game_map, message_log, game_state 
开发者ID:TStand90,项目名称:roguelike_tutorial_revised,代码行数:26,代码来源:initialize_new_game.py

示例2: __init__

# 需要导入模块: import entity [as 别名]
# 或者: from entity import Entity [as 别名]
def __init__(self, entity):
        if isinstance(entity, Entity):
            self.entity = entity
            self.table = entity.table
        elif isinstance(entity, str):
            self.entity = None
            self.table = entity
        else:
            raise ValueError("Invalid argument type.") 
开发者ID:Deep-Abstract,项目名称:sql_saying,代码行数:11,代码来源:dao.py

示例3: place_entities

# 需要导入模块: import entity [as 别名]
# 或者: from entity import Entity [as 别名]
def place_entities(room, entities, max_monsters_per_room, colors):
    """
    Randomly places entities.

    :param room: Rect
    :param entities: list<Entity>
    :param max_monsters_per_room: int
    :param colors: dict<tuple<int>(r, g, b)>>
    """
    # Get a random number of monsters
    number_of_monsters = randint(0, max_monsters_per_room)

    for i in range(number_of_monsters):
        # Choose a random location in the room
        x = randint(room.x1 + 1, room.x2 - 1)
        y = randint(room.y1 + 1, room.y2 - 1)

        if not any([entity for entity in entities if entity.x == x and entity.y == y]):
            if randint(0, 100) < 80:
                fighter_component = Fighter(hp=10, defense=0, power=3)
                ai_component = BasicMonster()

                monster = Entity(x, y, 'o', colors.get('desaturated_green'), 'Orc', blocks=True,
                                 render_order=RenderOrder.ACTOR, fighter=fighter_component, ai=ai_component)
            else:
                fighter_component = Fighter(hp=16, defense=1, power=4)
                ai_component = BasicMonster()

                monster = Entity(x, y, 'T', colors.get('darker_green'), 'Troll', blocks=True,
                                 render_order=RenderOrder.ACTOR, fighter=fighter_component, ai=ai_component)

            entities.append(monster) 
开发者ID:danieldan0,项目名称:python_roguelike,代码行数:34,代码来源:map_utils.py

示例4: get_game_variables

# 需要导入模块: import entity [as 别名]
# 或者: from entity import Entity [as 别名]
def get_game_variables(constants):
    fighter_component = Fighter(hp=100, defense=1, power=2)
    inventory_component = Inventory(26)
    level_component = Level()
    equipment_component = Equipment()
    player = Entity(0, 0, '@', (255, 255, 255), 'Player', blocks=True, render_order=RenderOrder.ACTOR,
                    fighter=fighter_component, inventory=inventory_component, level=level_component,
                    equipment=equipment_component)
    entities = [player]

    equippable_component = Equippable(EquipmentSlots.MAIN_HAND, power_bonus=2)
    dagger = Entity(0, 0, '-', constants['colors'].get('sky'), 'Dagger', equippable=equippable_component)
    player.inventory.add_item(dagger, constants['colors'])
    player.equipment.toggle_equip(dagger)

    game_map = GameMap(constants['map_width'], constants['map_height'])
    make_map(game_map, constants['max_rooms'], constants['room_min_size'],
             constants['room_max_size'], constants['map_width'], constants['map_height'], player, entities,
             constants['colors'])

    message_log = MessageLog(constants['message_x'], constants['message_width'],
                             constants['message_height'])

    game_state = GameStates.PLAYERS_TURN

    return player, entities, game_map, message_log, game_state 
开发者ID:TStand90,项目名称:roguelike_tutorial_revised_tdl,代码行数:28,代码来源:initialize_new_game.py

示例5: createEntity

# 需要导入模块: import entity [as 别名]
# 或者: from entity import Entity [as 别名]
def createEntity(namestr, parentstr, childstr):
    name = namestr.split(' ')
    parent = parentstr.split(' ')
    child = childstr.split(' ')

    entity = Entity(name, parent, child)
    entity.displayEntity()
    return entity 
开发者ID:wdxtub,项目名称:patriots,代码行数:10,代码来源:knowledgegraph.py

示例6: __init__

# 需要导入模块: import entity [as 别名]
# 或者: from entity import Entity [as 别名]
def __init__(self, pkt: pyshark.packet.packet.Packet):
        self.packets = []
        self.protocols = Counter()
        self.logger = Logger(self.__class__.__name__)

        is_packet_upstream = check_if_packet_is_upstream(pkt)
        if is_packet_upstream is not None:
            self.start_time = float(pkt.sniff_timestamp)
            self.end_time = float(pkt.sniff_timestamp)
            self.ingest(pkt)

            self.client = Entity(pkt, is_packet_upstream)
            self.server = Entity(pkt, not is_packet_upstream)
        else:
            self.logger.error("Packet does not include client configured IP. Packet number: " + pkt.number) 
开发者ID:Yotamho,项目名称:pcap-grapher,代码行数:17,代码来源:flow.py

示例7: mapToPXF

# 需要导入模块: import entity [as 别名]
# 或者: from entity import Entity [as 别名]
def mapToPXF(samples):
	# Add Entity(s)
	sample_1 = Entity(
                    id = "http://ga4gh.org/samples/1",
                    type = EntityType.sample)
	# sample_2 = Entity(
 #                    id = "http://ga4gh.org/samples/2",
 #                    type = EntityType.sample)

	# phenopacket_entities = [sample_1, sample_2]
	phenopacket_entities = [sample_1]

	environment = Environment()
	severity = ConditionSeverity()
	onset = TemporalRegion()
	offset = TemporalRegion()


	phenotype_1_1 = Phenotype(
                        environment=environment,
                        severity=severity,
                        onset=onset,
                        offset=offset)


	#phenotype_1_1.onset = TemporalRegion()
	phenotype_1_1.types = [OntologyClass()]
	phenotype_1_1.types[0].id = "HP:0003593"
	phenotype_1_1.types[0].label = "Infantile onset"

	phenotype_association_1_1 = PhenotypeAssociation(
                                entity = sample_1.id,
                                evidence_list = [],     # Sequence[Evidence]=[],
                                # created = "!!date 2016 2 9"
                                phenotype = phenotype_1_1)

	phenotype_profile_1 = [phenotype_association_1_1]   # : Sequence[PhenotypeAssociation]=[]
	phenopacket = PhenoPacket(
                        packet_id = "packet1",
                        title = "Biosample export",
                        entities = phenopacket_entities,
                        # schema = "journal-example-level-1",
                        # '@context = "http://phenopacket.github.io/context/context.jsonld",
                        phenotype_profile = phenotype_profile_1)

	print(phenopacket) 
开发者ID:EBISPOT,项目名称:ga4gh-biosamples,代码行数:48,代码来源:mapFromGA4GHToPXF.py


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