StaticEvent¶
Event that will be executed unless explicitly removed.
Can be added to the levelThread without an associated action, and it will passively wait untill a new action is assigned to it. Always assign a new action to the newAction attribute, rather than the action attribute, to prevent odd race conditions.
Constructor
StaticEvent ([action, remove]) |
Event that will be executed unless explicitly removed. |
Instance Attributes
action |
The current action that will be executed if this event is active. |
active |
The current action is only executed if active is set to True. |
newAction |
A new action that will replace the current action at the next time step. |
remove |
Set to True to have this event removed the next time it is executed. |
Details
-
class
StaticEvent
(action=None, remove=False)[source]¶ Constructs a StaticEvent object.
Parameters: - action – The function to call at every time step.
- remove – If set to True, this event will be deleted next time it is called.
Instance Attributes
-
action
¶ The current action that will be executed if this event is active. Do not change this attribute after the event has been scheduled, but use the newAction attribute instead.
-
active
¶ The current action is only executed if active is set to True. Assigning a newAction automatically sets active to True.
-
newAction
¶ A new action that will replace the current action at the next time step.
-
remove
¶ Set to True to have this event removed the next time it is executed.