Adventure Creator  1.76.2
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2022
AC.SortingMap Class Reference
Inheritance diagram for AC.SortingMap:

Public Member Functions

void UpdateSimilarFollowers ()
Vector3 GetAreaPosition (int i)
 Gets the boundary position of a particular SortingArea. More...
float GetScale (Vector3 followPosition)
 Gets an interpolated scale factor, based on a position in the scene. More...
void SetInBetweenScales ()

Public Attributes

bool affectSorting = true
SortingMapType mapType = SortingMapType.OrderInLayer
List< SortingAreasortingAreas = new List<SortingArea>()
bool affectScale = false
bool affectSpeed = true
int originScale = 100
SortingMapScaleType sortingMapScaleType = SortingMapScaleType.Linear
AnimationCurve scalingAnimationCurve

Protected Member Functions

void OnEnable ()
void Start ()
void OnDisable ()
void OnDrawGizmos ()

Static Protected Member Functions

static int SortByScreenPosition (FollowSortingMap o1, FollowSortingMap o2)

Protected Attributes

Transform _transform


Transform Transform [get]

Detailed Description

This script is used to change the sorting order and scale of 2D characters, based on their position in the scene. The instance of this class stored in SceneSettings' sortingMap variable will be read by FollowSortingMap components to determine what their SpriteRenderer's order and scale should be.

Member Function Documentation

◆ GetAreaPosition()

Vector3 AC.SortingMap.GetAreaPosition ( int  i)

Gets the boundary position of a particular SortingArea.

iThe index of the SortingArea to get the boundary position of
The boundary positon of the SortingArea

◆ GetScale()

float AC.SortingMap.GetScale ( Vector3  followPosition)

Gets an interpolated scale factor, based on a position in the scene.

followPositionThe position in the scene to get the scale factor for
The interpolated scale factor for any FollowSortingMap components at the given position

◆ SetInBetweenScales()

void AC.SortingMap.SetInBetweenScales ( )

Assigns the scale factors for all SortingArea data that lie in between the top and bottom boundaries.

◆ UpdateSimilarFollowers()

void AC.SortingMap.UpdateSimilarFollowers ( )

Adjusts all relevant FollowSortingMaps that are within the same region, so that they are all displayed correctly.

Member Data Documentation

◆ affectScale

bool AC.SortingMap.affectScale = false

True if characters that follow this map should have their scale affected

◆ affectSorting

bool AC.SortingMap.affectSorting = true

True if characters that follow this map should have their sorting affected

◆ affectSpeed

bool AC.SortingMap.affectSpeed = true

True if characters that follow this map should have their movement speed affected by the scale factor

◆ mapType

SortingMapType AC.SortingMap.mapType = SortingMapType.OrderInLayer

How SpriteRenderer components that follow this map are effected (OrderInLayer, SortingLayer)

◆ originScale

int AC.SortingMap.originScale = 100

The scale (as a percentage) that characters will have at the very top of the map (if affectScale = True)

◆ scalingAnimationCurve

AnimationCurve AC.SortingMap.scalingAnimationCurve

The AnimationCurve used to define character scaling, where 0s is the smallest scale, and 1s is the largest (if sortingMapScaleType = AnimationCurve)

◆ sortingAreas

List<SortingArea> AC.SortingMap.sortingAreas = new List<SortingArea>()

A List of SortingArea data that makes up the map

◆ sortingMapScaleType

SortingMapScaleType AC.SortingMap.sortingMapScaleType = SortingMapScaleType.Linear

How scaling values are defined (Linear, AnimationCurve)

Property Documentation

◆ Transform

Transform AC.SortingMap.Transform

A cache of the SortingMap's transform component