예제 #1
0
        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);
        }
예제 #2
0
        void LateUpdate()
        {
            DidWarp = false;

            var order = LayerSorting.GetSortingOrder(MovementLayer);

            _renderer.sortingOrder = order;

            if (Shadow)
            {
                Shadow.sortingOrder = order + _shadowSortOffset;
            }
        }
예제 #3
0
        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);
            }
        }