private void AdaptOrderInLayer() { auto_sort.RefreshSort(); if (bearer) { if (!rotate_item) { CharacterHoldItem char_bearer = bearer.GetComponent <CharacterHoldItem>(); int offset = char_bearer.GetCharacter().GetSide() == 0 ? 5 : -5; sprite_render.sortingOrder = char_bearer.GetCharacter().GetSortOrder() + offset; } } }
public void Take(CharacterHoldItem bearer) { this.bearer = bearer; last_bearer = bearer; collide.isTrigger = true; sprite_render.sortingLayerID = bearer.GetComponent <SpriteRenderer>().sortingLayerID; auto_sort.auto_sort = false; //Will be sorted based on character instead transform.localScale = start_size * carry_size; if (OnTake != null) { OnTake.Invoke(bearer.gameObject); } UpdateCarryItem(); }