Panda3D
Public Member Functions | Public Attributes | Static Public Attributes

AnfaPhasedObject Class Reference

Inheritance diagram for AnfaPhasedObject:
PhasedObject

List of all members.

Public Member Functions

def __init__
def __repr__
def __str__
def cleanup
def getAliasPhase
def getPhase
def getPhaseAlias
def loadPhaseAt
def loadPhaseAway
def loadPhaseFar
def loadPhaseNear
def setAlias
def setPhase
def unloadPhaseAt
def unloadPhaseAway
def unloadPhaseFar
def unloadPhaseNear

Public Attributes

 aliasPhaseMap
 phase
 phaseAliasMap

Static Public Attributes

tuple notify = directNotify.newCategory("PhasedObject")

Detailed Description

This is an example class to demonstrate the concept of
alias mapping for PhasedObjects.

As the distance between an observer and this object closes,
we would set the phase level succesively higher, with an initial
phase of 'Away' being set in __init__:

setPhase('Far') -> invokes loadPhaseFar()
setPhase('Near') -> invokes loadPhaseNear()

Now let's say the objects start moving away from each other:

setPhase('Far') -> invokes unloadPhaseNear()
setPhase('Away') -> invokes unloadPhaseFar()

Now one object teleports to the other:

setPhase('At') -> invokes loadPhase('Far'),
                  then    loadPhase('Near'),
                  then    loadPhase('At')

Now the phased object is destroyed, we must clean it up
before removal:

cleanup() -> invokes unloadPhase('At')
             then    unloadPhase('Near')
             then    unloadPhase('Far')
             then    unloadPhase('Away')

Constructor & Destructor Documentation

def __init__ (   self)

Member Function Documentation

def __repr__ (   self) [inherited]
def __str__ (   self) [inherited]
def cleanup (   self) [inherited]
Will force the unloading, in correct order, of all currently
loaded phases.
def getAliasPhase (   self,
  alias 
) [inherited]
Returns the phase number of an alias, if it exists.
Otherwise, returns the alias.
def getPhase (   self) [inherited]
Returns the current phase (or alias, if defined)
this object is currently in.
def getPhaseAlias (   self,
  phase 
) [inherited]
Returns the alias of a phase number, if it exists.
Otherwise, returns the phase number.
def loadPhaseAt (   self)
def loadPhaseAway (   self)
def loadPhaseFar (   self)
def loadPhaseNear (   self)
def setAlias (   self,
  phase,
  alias 
) [inherited]
Map an alias to a phase number.

phase must be >= 0 and alias must be a string
of characters suitable for python variable names.

The mapping must be one-to-one.        
def setPhase (   self,
  aPhase 
) [inherited]
aPhase can be either a phase number or a predefined alias.

Will invoke a sequence of loadPhase*() or unloadPhase*()
functions corresponding to the difference between the current
phase and aPhase, starting at the current phase.
def unloadPhaseAt (   self)
def unloadPhaseAway (   self)
def unloadPhaseFar (   self)
def unloadPhaseNear (   self)

Member Data Documentation

aliasPhaseMap [inherited]
tuple notify = directNotify.newCategory("PhasedObject") [static, inherited]
phase [inherited]
phaseAliasMap [inherited]
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties