public bool TryOutBox(ItemJunction junc) { if (DisplayLimitTimer <= 0.0f) { return(false); } if (junc?.ItemImages == null) { return(false); } if (junc.ItemImages.transform.childCount != 0) { return(false); } this.gameObject.transform.parent = junc.ItemImages.transform; mState = PurchaseOrderStete.eState_Set; GetComponent <BoxCollider2D>().enabled = false; var itemImages = gameObject.GetComponentsInChildren <ItemImage>(); foreach (var itemImage in itemImages) { itemImage.GetComponent <BoxCollider2D>().enabled = false; } IsOutBoxed = true; return(true); }
/// <summary> /// /// </summary> public bool TryInBox(ItemJunction junc) { var itemImage = junc?.ItemImages; if (itemImage == null) { return(false); } var trans = itemImage.transform; if (trans == null) { return(false); } if (3 <= trans.childCount) { return(false); } gameObject.transform.parent = trans; State = ItemImageState.AtBox; var sprite = gameObject.GetComponent <SpriteRenderer>(); if (sprite != null) { sprite.sortingOrder = 41; } var collider = gameObject.GetComponent <BoxCollider2D>(); if (collider) { collider.enabled = false; } return(true); }