Adventure Creator  1.66.1
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2018
AC.FollowSortingMap Class Reference
Inheritance diagram for AC.FollowSortingMap:

Public Member Functions

void AfterLoad ()
 
void SetDepth (int depth)
 Sets the depth of the GameObject compared with other GameObjects in the same Sorting Map region, by shifting the position along the "depth" axis by a small amount. More...
 
void UpdateSortingMap ()
 
SortingMap GetSortingMap ()
 Gets the SortingMap that this component follows. More...
 
void SetSortingMap (SortingMap _sortingMap)
 Sets the SortingMap that this component follows. More...
 
void LockSortingOrder (int order)
 Locks the SpriteRenderer to a specific order within its layer. More...
 
void LockSortingLayer (string layer)
 Locks the SpriteRenderer to a specific layer. More...
 
float GetLocalScale ()
 Gets the intended scale factor of the GameObject, based on its position on the scene's SortingMap. More...
 
float GetLocalSpeed ()
 Gets the indended speed factor of the GameObject, based on its position on the scene's SortingMap. More...
 

Public Attributes

bool lockSorting = false
 
bool affectChildren = true
 
bool followSortingMap = true
 
SortingMap customSortingMap = null
 
bool offsetOriginal = false
 
bool livePreview = false
 

Protected Member Functions

void SetOriginalDepth ()
 

Protected Attributes

Renderer [] renderers
 
Renderer _renderer
 

Properties

int SortingOrder [get]
 
string SortingLayer [get]
 
int SharedDepth [get]
 

Detailed Description

Attach this script to a GameObject to affect the sorting values of its SpriteRenderer component, according to the scene's SortingMap. It is also used by the Char script to scale a 2D character's sprite child, if the SortingMap controls scale. This is intended for 2D character sprites, to handle their scale and display when moving around a scene.

Member Function Documentation

◆ AfterLoad()

void AC.FollowSortingMap.AfterLoad ( )

Called after a scene change.

◆ GetLocalScale()

float AC.FollowSortingMap.GetLocalScale ( )

Gets the intended scale factor of the GameObject, based on its position on the scene's SortingMap.

Returns
The intended scale factor. If 0, then the Char script will not make use of it.

◆ GetLocalSpeed()

float AC.FollowSortingMap.GetLocalSpeed ( )

Gets the indended speed factor of the GameObject, based on its position on the scene's SortingMap.

Returns
The intended speed factor. This is used by the Char script to amend the character's speed.

◆ GetSortingMap()

SortingMap AC.FollowSortingMap.GetSortingMap ( )

Gets the SortingMap that this component follows.

Returns
The SortingMap that this component follows

◆ LockSortingLayer()

void AC.FollowSortingMap.LockSortingLayer ( string  layer)

Locks the SpriteRenderer to a specific layer.

Parameters
layerThe layer to lock the SpriteRenderer to

◆ LockSortingOrder()

void AC.FollowSortingMap.LockSortingOrder ( int  order)

Locks the SpriteRenderer to a specific order within its layer.

Parameters
orderThe order within its current layer to lock the SpriteRenderer to

◆ SetDepth()

void AC.FollowSortingMap.SetDepth ( int  depth)

Sets the depth of the GameObject compared with other GameObjects in the same Sorting Map region, by shifting the position along the "depth" axis by a small amount.

Parameters
depthThe amount to offset the GameObject by. The true shift distance will be this value multipled by the SceneSettings script's sharedLayerSeparationDistance value

◆ SetSortingMap()

void AC.FollowSortingMap.SetSortingMap ( SortingMap  _sortingMap)

Sets the SortingMap that this component follows.

Parameters
_sortingMapThe SortingMap to follow. If this is null, then it will revert to the scene's default.

◆ UpdateSortingMap()

void AC.FollowSortingMap.UpdateSortingMap ( )

Tells the scene's SortingMap to account for this particular instance of FollowSortingMap.

Member Data Documentation

◆ affectChildren

bool AC.FollowSortingMap.affectChildren = true

If True, then the sorting values of child SpriteRenderers will be affected as well

◆ customSortingMap

SortingMap AC.FollowSortingMap.customSortingMap = null

The SortingMap to follow, if not the scene default (and followSortingMap = False)

◆ followSortingMap

bool AC.FollowSortingMap.followSortingMap = true

If True, then the component will follow the default SortingMap, as defined in SceneSettings

◆ livePreview

bool AC.FollowSortingMap.livePreview = false

If True, then the script will update the SpriteRender's sorting values when the game is not running

◆ lockSorting

bool AC.FollowSortingMap.lockSorting = false

If True, the SpriteRenderer's sorting values will be locked to their current values

◆ offsetOriginal

bool AC.FollowSortingMap.offsetOriginal = false

If True, then the SpriteRenderer's sorting values will be increased by their original values when the game began

Property Documentation

◆ SharedDepth

int AC.FollowSortingMap.SharedDepth
get

The relative depth compared with other GameObjects in the same Sorting Map region.

◆ SortingLayer

string AC.FollowSortingMap.SortingLayer
get

The layer of the sprite, according to the GameObject's position in the SortingMap, provided that the mapType = SortingMapType.SortingLayer

◆ SortingOrder

int AC.FollowSortingMap.SortingOrder
get

The order of the sprite, according to the GameObject's position in the SortingMap, provided that the mapType = SortingMapType.OrderInLayer