本文整理匯總了Python中utils.Vec.down方法的典型用法代碼示例。如果您正苦於以下問題:Python Vec.down方法的具體用法?Python Vec.down怎麽用?Python Vec.down使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類utils.Vec
的用法示例。
在下文中一共展示了Vec.down方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: render
# 需要導入模塊: from utils import Vec [as 別名]
# 或者: from utils.Vec import down [as 別名]
#.........這裏部分代碼省略.........
):
p = x + self.parent.loc
d = ((Vec2f(x.x, x.z) - c).mag()) / maxd
n = (
pn.noise3(
(p.x + r) / 4.0,
y / 4.0,
p.z / 4.0) + 1.0) / 2.0
if (n >= d + .10):
self.parent.parent.setblock(p, materials.Sand)
elif (n >= d):
self.parent.parent.setblock(p, materials.Gravel)
else:
self.parent.parent.setblock(p, materials._floor)
# Find wire locations
# h0
# Cool fact: in 12w30c tripwires will trigger sand without hooks.
if (halls[0] != 0):
for x in xrange(1, self.parent.halls[0].size - 1):
p = Vec(self.parent.halls[0].offset + x,
y - 1,
self.parent.hallLength[0])
# if x == 0:
# wirehooks.add((p, 4+3))
# elif x == self.parent.halls[0].size-1:
# wirehooks.add((p, 4+1))
# else:
# wires.add(p)
wires.add(p)
# h1
if (halls[1] != 0):
for x in xrange(1, self.parent.halls[1].size - 1):
wires.add(
Vec(
(self.parent.parent.room_size -
self.parent.hallLength[1] - 1),
y - 1,
self.parent.halls[1].offset + x
)
)
# h2
if (halls[2] != 0):
for x in xrange(1, self.parent.halls[2].size - 1):
wires.add(
Vec(
self.parent.halls[2].offset + x,
y - 1,
(self.parent.parent.room_size -
self.parent.hallLength[2] - 1)
)
)
# h3
if (halls[3] != 0):
for x in xrange(1, self.parent.halls[3].size - 1):
wires.add(
Vec(
self.parent.hallLength[3],
y - 1,
self.parent.halls[3].offset + x
)
)
for p in wires:
self.parent.parent.setblock(
offset + p.down(1),
materials.Gravel,
lock=True
)
self.parent.parent.setblock(offset + p,
materials.Tripwire, hide=True)
# for p in wirehooks:
# self.parent.parent.setblock(offset+p[0].down(1), mat)
# self.parent.parent.setblock(offset+p[0],
# materials.TripwireHook, p[1])
# Draw the bridges, if a hallway exists.
# h0 -> c1
# h1 -> c2
# h2 -> c3
# h3 -> c4
if (halls[0] != 0):
for p in utils.iterate_cube(offset + h0, offset + c1):
self.parent.parent.setblock(p, mat)
if (halls[1] != 0):
for p in utils.iterate_cube(offset + h1, offset + c2):
self.parent.parent.setblock(p, mat)
if (halls[2] != 0):
for p in utils.iterate_cube(offset + h2, offset + c3):
self.parent.parent.setblock(p, mat)
if (halls[3] != 0):
for p in utils.iterate_cube(offset + h3, offset + c4):
self.parent.parent.setblock(p, mat)
# Draw the connecting bridges.
# c1 -> c2
# c2 -> c3
# c3 -> c4
for p in utils.iterate_cube(offset + c1, offset + c2):
self.parent.parent.setblock(p, mat)
for p in utils.iterate_cube(offset + c2, offset + c3):
self.parent.parent.setblock(p, mat)
for p in utils.iterate_cube(offset + c3, offset + c4):
self.parent.parent.setblock(p, mat)