public void RemovePickUp(PlayerName pName) { PickUpContainer container = containerObj.Find(x => x.pName == pName); if (container != null) { Destroy(container.transContainer.GetChild(0).gameObject); } }
public void AddPickUp(PlayerName pName, Veggies vName) { PickUpContainer container = containerObj.Find(x => x.pName == pName); if (container != null) { GameObject newPickUp = Instantiate(pickUpUIPrefab); newPickUp.transform.GetComponentInChildren <Text> ().text = vName.ToString(); newPickUp.transform.SetParent(container.transContainer, false); } }
public void RemoveAllPickUp(PlayerName pName) { PickUpContainer container = containerObj.Find(x => x.pName == pName); if (container != null) { int cnt = container.transContainer.childCount; foreach (Transform item in container.transContainer.transform) { Destroy(item.gameObject); } } }