Commit | Line | Data |
---|---|---|
e1438449 | 1 | from panda3d.bullet import BulletBoxShape, BulletRigidBodyNode, BulletGhostNode |
0e86689f | 2 | from pmachines.items.item import Item, StillStrategy |
e1438449 FC |
3 | |
4 | ||
5 | class Domino(Item): | |
6 | ||
ef3c36bf FC |
7 | def __init__(self, world, plane_node, cb_inst, curr_bottom, repos, mass=1, pos=(0, 0, 0), r=0, count=0): |
8 | super().__init__(world, plane_node, cb_inst, curr_bottom, repos, 'assets/gltf/domino/domino.gltf', mass=mass, pos=pos, r=r, count=count) | |
e1438449 | 9 | |
ea38777c FC |
10 | def _set_shape(self): |
11 | self.node.add_shape(BulletBoxShape((.1, .25, .5))) | |
b41381b2 FC |
12 | |
13 | ||
0e86689f | 14 | class UpStrategy(StillStrategy): |
b41381b2 | 15 | |
0e86689f FC |
16 | def __init__(self, np, tgt_degrees): |
17 | super().__init__(np) | |
b41381b2 | 18 | self._tgt_degrees = tgt_degrees |
0e86689f | 19 | self._np = np |
b41381b2 FC |
20 | |
21 | def end_condition(self): | |
0e86689f FC |
22 | return super().end_condition() and abs(self._np.get_r()) <= self._tgt_degrees |
23 | ||
24 | ||
25 | class DownStrategy(StillStrategy): | |
26 | ||
27 | def __init__(self, np, tgt_degrees): | |
28 | super().__init__(np) | |
29 | self._tgt_degrees = tgt_degrees | |
30 | self._np = np | |
31 | ||
32 | def end_condition(self): | |
33 | return super().end_condition() and abs(self._np.get_r()) >= self._tgt_degrees |