def __init__(self, name, phaseParamMap={}, autoCleanup=True, enterPrefix='enter', exitPrefix='exit', phaseCollideMask=BitMask32.allOn(), fromCollideNode=None): NodePath.__init__(self, name) self.phaseParamMap = phaseParamMap self.phaseParamList = sorted(phaseParamMap.items(), key=lambda x: x[1], reverse=True) PhasedObject.__init__( self, dict([(alias, phase) for phase, alias in enumerate( [item[0] for item in self.phaseParamList])])) self.__id = self.__allocateId() self.autoCleanup = autoCleanup self.enterPrefix = enterPrefix self.exitPrefix = exitPrefix self.phaseCollideMask = phaseCollideMask self.cTrav = base.cTrav self.fromCollideNode = fromCollideNode self._colSpheres = [] self.reset()
def cleanup(self): self.__disableCollisions(cleanup=True) for sphere in self._colSpheres: sphere.remove() self._colSpheres = [] PhasedObject.cleanup(self)
def setPhase(self, aPhase): phase = self.getAliasPhase(aPhase) PhasedObject.setPhase(self, aPhase) self.__disableCollisions() self.__enableCollisions(phase) if phase == -1 and self.autoCleanup: self.cleanup() else: self.__oneTimeCollide()
def cleanup(self): """ Disables all collisions. Ignores all owned event listeners. Unloads all unloaded phases. """ self.__disableCollisions(cleanup = True) for sphere in self._colSpheres: sphere.remove() self._colSpheres = [] PhasedObject.cleanup(self)
def cleanup(self): """ Disables all collisions. Ignores all owned event listeners. Unloads all unloaded phases. """ self.__disableCollisions(cleanup=True) for sphere in self._colSpheres: sphere.remove() self._colSpheres = [] PhasedObject.cleanup(self)
def setPhase(self, aPhase): """ See PhasedObject.setPhase() """ phase = self.getAliasPhase(aPhase) PhasedObject.setPhase(self, aPhase) self.__disableCollisions() self.__enableCollisions(phase) if phase == -1 and self.autoCleanup: self.cleanup() else: self.__oneTimeCollide()
def __init__(self, name, phaseParamMap = {}, autoCleanup = True, enterPrefix = 'enter', exitPrefix = 'exit', phaseCollideMask = BitMask32.allOn(), fromCollideNode = None): NodePath.__init__(self, name) self.phaseParamMap = phaseParamMap self.phaseParamList = sorted(phaseParamMap.items(), key = lambda x: x[1], reverse = True) PhasedObject.__init__(self, dict([(alias,phase) for (phase,alias) in enumerate([item[0] for item in self.phaseParamList])])) self.__id = self.__allocateId() self.autoCleanup = autoCleanup self.enterPrefix = enterPrefix self.exitPrefix = exitPrefix self.phaseCollideMask = phaseCollideMask self.cTrav = base.cTrav self.fromCollideNode = fromCollideNode self._colSpheres = [] self.reset()