本文整理汇总了Python中objects.Object类的典型用法代码示例。如果您正苦于以下问题:Python Object类的具体用法?Python Object怎么用?Python Object使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Object类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, sequence, \
id, type, name, \
size, \
posx, posy, posz, \
velx, vely, velz, \
contains, \
order_types, \
order_number, \
modify_time, \
owner, resources):
Object.__init__(self, sequence, \
id, type, name, \
size, \
posx, posy, posz, \
velx, vely, velz, \
contains, \
order_types, \
order_number, \
modify_time)
self.length += 4 + 4 + 16 * len(resources)
self.owner = owner
for r in resources:
if len(r) != 4:
raise TypeError("Resources should be 4 length, <id> <surface> <minable> <inaccess>")
self.resources = resources
示例2: __init__
def __init__(self, model, shape, element, lvl, duration, damage):
Object.__init__(self, model, shape, element)
self.duration = duration
self.elapsed = 0.0
self.lvl = lvl
self.damage = damage
示例3: __init__
def __init__( self, stats, ai, xp, yp, zp=0, ori=0.0, xi=0, yi=0, zi=0, ri=0, thrust=0 ):
Object.__init__( self, stats, xp, yp, zp, ori, xi, yi, zi, ri )
self.alive = True
self.maxOri = 2*pi
self.thrust = thrust
self.rg = 0
self.shieldVsMass = self.stats.shieldVsMass
self.shieldVsEnergy = self.stats.shieldVsEnergy
self.hullVsMass = self.stats.hullVsMass
self.hullVsEnergy = self.stats.hullVsEnergy
self.ai = ai
self.dockedTo = False
self.dockedAt = 0 # tick at docking
self.hull = stats.maxHull
self.shield = stats.maxShield
self.inertiaControl = True
self.headed = True # differentiate bases from ships
self.pulsedUntil = -1000
self.inNebula = False # variable state
self.inertiaMod = 1
self.thrustBoost = 0
self.shipyards = [] # list of regulard shipyards
self.guestDocked = [] # list of temporary docks
示例4: __init__
def __init__(self, x, y, char, name, color, slot, power_bonus=0, defense_bonus=0, max_hp_bonus=0):
Object.__init__(self, x, y, char, name, color, blocks=False, always_visible=False)
self.slot = slot
self.is_equipped = False
self.power_bonus = power_bonus
self.defense_bonus = defense_bonus
self.max_hp_bonus = max_hp_bonus
示例5: __init__
def __init__(self, parent_context, param_list, statements):
import proto_functions
Object.__init__(self, prototype=proto_functions.function_proto)
self.parent_context = parent_context
self.param_list = param_list
self.statements = statements
self.constructing_prototype = Object()
示例6: __init__
def __init__(self, x, y, char, name, color, blocks=True, ai=None, always_visible=False,
equipment=None, character_class=None, creature_type=None, xp=0, screen=None):
#call super constructor to create the map object
Object.__init__(self, x, y, char, name, color, blocks=blocks, always_visible=always_visible)
self.character_class = character_class
if self.character_class:
# let the fighter component know who owns it
self.character_class.owner = self
self.screen = screen
if self.screen:
# set the screen element in the character_class
self.character_class.screen = screen
self.ai = ai
if self.ai:
# let the ai component know who owns it
self.ai.owner = self
self.xp = xp
self.dead = False
self.inventory = []
#set the default equipment dictionary.
self.equipment = {'head': None, 'body':None, 'legs':None, 'hands':None, 'feet':None, 'left hand': None, 'right hand': None}
self.player = None
示例7: __init__
def __init__(self, sequence, \
id, type, name, \
size, \
posx, posy, posz, \
velx, vely, velz, \
contains, \
order_types, \
order_number, \
modify_time, \
owner, ships, damage):
Object.__init__(self, sequence, \
id, type, name, \
size, \
posx, posy, posz, \
velx, vely, velz, \
contains, \
order_types, \
order_number, \
modify_time)
self.length += 4 + 4 + len(ships) * 8 + 4
self.owner = owner
self.ships = ships
self.damage = damage
示例8: tick
def tick(self, time_elapsed):
Object.tick(self, time_elapsed)
self.elapsed += time_elapsed
if (self.elapsed >= self.duration):
self.lvl.remove_object(self)
示例9: __init__
def __init__(self, position):
Object.__init__(self)
self.frame = 0
self._position = position
self.frames = self._cls_frames[:]
self.frames_count = len(self.frames)
self._current_frame_time = 0
self._finished = False
self.load_frame()
示例10: __init__
def __init__(self, model, shape, element, lvl, damage, target_obj, attract_v):
Object.__init__(self, model, shape, element)
self.lvl = lvl
self.damage = damage
self.target = target_obj
self.velocity = attract_v
self.dir = Vector3d(0.,0.,0.)
示例11: tick
def tick(self, time_elapsed):
if (hasattr(self.target, 'destroyed') and self.target.destroyed):
self.lvl.remove_object(self)
return
self.dir = (self.target.shape.position - self.shape.position).normalizing()
v = self.dir.scalar(self.velocity)
self.shape.velocity = v
Object.tick(self, time_elapsed)
示例12: tick
def tick(self, time_elapsed):
Object.tick(self, time_elapsed)
self.update_mouse_track(time_elapsed)
self.update_spinning(time_elapsed)
self.update_strafe(time_elapsed)
self.simple_gun.tick(time_elapsed)
self.simple_missile.tick(time_elapsed)
self.collision_set = self.keep_colliding
self.keep_colliding = set()
示例13: __init__
def __init__(self, model, shape, element, level):
Object.__init__(self, model, shape, element)
cfg = Config('physics','Ship')
self.move_force_sz = cfg.get('move_force')
self.spin_velocity = cfg.get('spin_velocity')
self.strafe_force = cfg.get('strafe_force')
self.shape.forces_res.append(cfg.get('vacuum_resistance'))
self.breake_rate = cfg.get('breake_rate')
self.mouse_sensivity = Config('game','Mouse').get('sensivity')
self.level = level
self.rotation = Quaternion.from_axis_rotations(0.,0.,0.)
self.ship_dir = None
self.up_dir = None
self.spinning = {
'up' : False,
'down' : False,
'left' : False,
'right' : False
}
self.vectors = {
'up' : (Vector3d.x_axis(), 1.),
'down' : (Vector3d.x_axis(), -1.),
'left' : (Vector3d.y_axis(), 1.),
'right' : (Vector3d.y_axis(), -1.)
}
self.strafe = {
'forward': False,
'left' : False,
'right' : False,
'breake' : False
}
self.strafe_vectors = {
'forward':Vector3d(0.,0.,-0.7),
'left' : Vector3d(-0.9,0.,0.),
'right' : Vector3d(0.9,0.,0.),
'breake' : Vector3d(0.,0.,1.)
}
self.angles = [0.,0.]
self.mouse_target = [0.,0.]
self.collision_set = set()
self.keep_colliding = set()
示例14: __init__
def __init__(self, map, con, x,y, char, color, fighter=None, level=None):
Object.__init__(self, None, con, x,y, char,
libtcod.namegen_generate('Celtic male'), color, True, fighter=fighter, level=level
)
map.player = self
self.inventory = Inventory()
self.mods = Inventory()
class Item:
stack_limit = 5
obj = Object(None, con, None,None, 'b', 'boost', color, item=Item())
obj.mod = mods.Boost()
self.mods.add_item(obj)
示例15: _create
def _create(cls, repo, path, resolve, reference, force):
"""internal method used to create a new symbolic reference.
If resolve is False,, the reference will be taken as is, creating
a proper symbolic reference. Otherwise it will be resolved to the
corresponding object and a detached symbolic reference will be created
instead"""
full_ref_path = cls.to_full_path(path)
abs_ref_path = os.path.join(repo.git_dir, full_ref_path)
# figure out target data
target = reference
if resolve:
target = Object.new(repo, reference)
if not force and os.path.isfile(abs_ref_path):
target_data = str(target)
if isinstance(target, SymbolicReference):
target_data = target.path
if not resolve:
target_data = "ref: " + target_data
if open(abs_ref_path, 'rb').read().strip() != target_data:
raise OSError("Reference at %s does already exist" % full_ref_path)
# END no force handling
ref = cls(repo, full_ref_path)
ref.reference = target
return ref