本文整理汇总了Python中unit.Unit.type方法的典型用法代码示例。如果您正苦于以下问题:Python Unit.type方法的具体用法?Python Unit.type怎么用?Python Unit.type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unit.Unit
的用法示例。
在下文中一共展示了Unit.type方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Unit
# 需要导入模块: from unit import Unit [as 别名]
# 或者: from unit.Unit import type [as 别名]
from unit import Unit
from constants import *
from graph import Graph
warpling = Unit()
warpling.type = WARPLING_TYPE
warpling.name = "Warpling"
warpling.cost = 0
warpling.moves = Graph()
warpling.moves.add_new_node(0, 0)
warpling.moves.add_new_node(0, 1)
warpling.moves.connect_adjacent_nodes()
knight = Unit()
knight.type = KNIGHT_TYPE
knight.name = "Knight"
knight.cost = 3
knight.moves = Graph()
knight.moves.add_new_node(0, 0)
knight.moves.add_new_node(1, 2)
knight.moves.add_new_node(-1, 2)
knight.moves.add_new_node(2, 1)
knight.moves.add_new_node(2, -1)
knight.moves.add_new_node(1, -2)
knight.moves.add_new_node(-1, -2)
knight.moves.add_new_node(-2, -1)
knight.moves.add_new_node(-2, 1)
knight.moves.connect_all_to(knight.moves.find_node_by_position(0, 0))
bishop = Unit()
bishop.type = BISHOP_TYPE