Central storage for all GameObjects that are to be drawn. Supports HUD, Foreground, Actor, Shadow Receiver, and Background layers
Found in Chapter 11, page 689 of the textbook
Example: 11.3 Layer Manager- Source:
Methods
(inner) addAsShadowCaster(obj)
Add a ShadowCaster to each ShadowReciever in the shadow receiver layer
Parameters:
| Name | Type | Description |
|---|---|---|
obj |
ShadowCaster | ShadowCaster to add |
- Source:
(inner) addToLayer(layerEnum, obj)
Add a GameObject to a layer's list
Parameters:
| Name | Type | Description |
|---|---|---|
layerEnum |
integer | index of the layer to add to |
obj |
GameObject | GameObject to add |
- Source:
(inner) cleanUp()
Set each layer to an empty GameObjectSet
- Source:
(inner) drawAllLayers(aCamera)
Draw every GameObject on every layer to the Camera
Parameters:
| Name | Type | Description |
|---|---|---|
aCamera |
Camera | the Camera to draw to |
- Source:
(inner) drawLayer(layerEnum, aCamera)
Calls draw() on all the GameObjects in the indexed layer
Parameters:
| Name | Type | Description |
|---|---|---|
layerEnum |
integer | the layer's index |
aCamera |
Camera | the Camera to draw to |
- Source:
(inner) init()
Initialize the layers by setting each layer to an empty GameObjectSet
- Source:
(inner) layerSize(layerEnum) → {integer}
Returns the number of GameObject in a specified layer
Parameters:
| Name | Type | Description |
|---|---|---|
layerEnum |
integer | index of the layer to access |
- Source:
Returns:
the number of GameObjects
- Type
- integer
(inner) moveToLayerFront(layerEnum, obj)
Move a GameObject to the last index of the layer, appending it if not already present
Parameters:
| Name | Type | Description |
|---|---|---|
layerEnum |
integer | the index of the layer to add to |
obj |
GameObject | GameObject to move to the end |
- Source:
(inner) removeFromLayer(layerEnum, obj)
Remove a GameObject from the indexed layer
Parameters:
| Name | Type | Description |
|---|---|---|
layerEnum |
integer | the index of the layer to access |
obj |
GameObject | GameObject to be removed |
- Source:
(inner) updateAllLayers()
Update every GameObject on every layer
- Source:
(inner) updateLayer(layerEnum)
Calls update() on all the GameObjects in the indexed layer
Parameters:
| Name | Type | Description |
|---|---|---|
layerEnum |
integer | the layer's index |
- Source: