void Awake() { var renderer = GetComponent <Renderer>(); var collider = GetComponent <Collider2D>(); var bounds = collider ? collider.bounds : renderer.bounds; var min = Vector2Int.FloorToInt(bounds.min); var max = Vector2Int.CeilToInt(bounds.max); _occupiedTiles = new RectInt(min, max - min); renderer.sortingOrder = LayerSorting.GetSortingOrder(CollisionLayer); }
void LateUpdate() { DidWarp = false; var order = LayerSorting.GetSortingOrder(MovementLayer); _renderer.sortingOrder = order; if (Shadow) { Shadow.sortingOrder = order + _shadowSortOffset; } }
void Awake() { var sorting = GetComponent <SortingGroup>(); sorting.sortingOrder = LayerSorting.GetSortingOrder(CollisionLayer); SetSortOrder(Roof); SetSortOrder(Facade); foreach (var door in Doors) { SetSortOrder(door); } foreach (var accessory in Accessories) { SetSortOrder(accessory); } }