Class: StateManager
Extends: adventurejs.Atom
Defined in: adventure/StateManager.js, line 6
StateManager is a special class used
for storing general state variables. For example,
tangible.is
is used to store states such as
tangible.is.closed,
tangible.is.locked,
tangible.is.global,
etc.
This is done chiefly for organizational purposes. With hundreds of
properties per asset, it seemed cleaner
to group similar types of properties into clusters and access them
through dot notation, rather than leave hundreds of properties
floating around the top level of each object. The reason to make it a
classed object rather than a generic object (as we do for some collections)
is so we can add prototype methods and properties that have access to scope
of this
(meaning the parent asset) and game
(the top level game object).
State containers and their values are passed down the inheritance chain.
For example: Tangible inherits from
Asset, and
asset.is.global
is available on
tangible.is.global.
It's also possible to override
inherited nested properties. For example:
Exit inherits
tangible.is.closed
and
tangible.is.locked,
but overrides them with new definitions in order to account
for Exit's relationship to the linked class
Aperture.
Private Constructor:
var foo = new adventurejs.StateManager(game_name, name, parent_id)
Parameters:
-
game_name
String
Name of top level game instance that is scoped to window. -
name
String
Instance name. -
parent_id
String
The ID of the containing asset instance.
- Index
- Methods
- Properties
Index
Methods:
- Inherited from Atom getInheritance
- Inherited from Atom hasClass
- Inherited from Atom Overrides from Atom set
Properties:
Methods Collapse all |
getInheritance() → {Array}
Defined in: adventure/Atom.js, line 151
Inherited from: adventurejs.Atom#getInheritance
Returns:
Array
hasClass(prop) → {Boolean}
Defined in: adventure/Atom.js, line 131
Inherited from: adventurejs.Atom#hasClass
Parameters:
-
prop
String
Name of the class to test for.
Returns:
Boolean
set(props) → {Object}
Defined in: adventure/Atom.js, line 119
Overrides from: adventurejs.Atom#set
Parameters:
-
props
Object
A generic object containing properties to copy to the Object instance.
Returns:
Object
Returns the instance the method is called on (useful for chaining calls.)
Properties |
game :Getter
Defined in: adventure/Atom.js, line 110
Inherited from: adventurejs.Atom#game
this.game
.
Name :String
Defined in: adventure/Atom.js, line 97
Inherited from: adventurejs.Atom#Name