public void PickSaladPlate(Chef chef) { Plate plateObject = chef.pUsingChoppingBoard.GetComponent <ChoppingBoard>().plate; Salad saladInPlate = plateObject.GetComponent <Plate>().pSalad; GameObject dummyPlate = Instantiate(chef.pUsingChoppingBoard.GetComponent <ChoppingBoard>().plate.gameObject, chef.pItemsHolder); chef.pSaladPickedToDeliver = saladInPlate.Copy(); saladInPlate.Clear(); plateObject.itemHolder.transform.ClearChildren(); dummyPlate.GetComponent <Collider2D>().enabled = false; }
private Plate GetFreePlate(Transform chef) { RaycastHit2D hit = Physics2D.Raycast(chef.position, Vector2.zero); Plate plate = null; if (hit.collider != null) { plate = hit.collider.GetComponent <Plate>(); if (plate == null || plate.pIsInUse) { plate = null; } } return(plate); }