public void Initialize(IcecreamTaste icecream, bool isThinkingFace = false) { Taste = icecream; ThinkingFace = isThinkingFace; Image.sprite = IcecreamImages[(int)icecream]; if (ThinkingFace) { ThinkingFaceImage.enabled = true; } }
void MakeCustomer() { // 웃음벨 여부 var isLaughBell = Random.Range(0, 100) < laughBellProb; // 주문 결정 List <IcecreamTaste> tasteList = new List <IcecreamTaste>(); List <bool> thinkingFaceList = new List <bool>(); var scoopNumber = Random.Range(minScoop, maxScoop + 1); for (int i = 0; i < scoopNumber; i++) { IcecreamTaste taste = (IcecreamTaste)Random.Range(0, icecreamVary); tasteList.Add(taste); var isThinkingFace = Random.Range(0, 100f) < thinkingFaceProb; thinkingFaceList.Add(isThinkingFace); } var customerObject = Instantiate(CustomerPrefab, CustomerParent.transform); var customer = customerObject.GetComponent <Customer>(); customer.Initialize(isLaughBell, tasteList, thinkingFaceList); customers.Add(customer); }