void SitAndEat() { if (isChanged) { ChairInfo.chairs[chairNum].isAllocated = true; //자리있어요 animator.SetInteger("State", 2); isChanged = false; time = 0; } time += Time.deltaTime; if (time > 10.0f) { if (InventoryInfo.reputation + 1 >= -10 && InventoryInfo.reputation + 1 <= 10) { InventoryInfo.reputation++; } isChanged = true; if (orderCount <= 0) { myState = NormalGuestState.FindDoorOut; return; } myState = NormalGuestState.Order; wasOrdered = true; guestOrderedFood = (UIController.Food)Random.Range(2, System.Enum.GetValues(typeof(UIController.Food)).Length); orderCount--; } }
public static UIController.Food playerOwnedFood; //플레이어가 현재 들고 있는 음식은 ? // Use this for initialization void Start() { _transform = this.gameObject.GetComponent <Transform>(); nvAgent = this.gameObject.GetComponent <NavMeshAgent>(); animator = this.gameObject.GetComponent <Animator>(); cam = GameObject.Find("Main Camera").GetComponent <Camera>(); targetPos = this.gameObject.transform.position; distanceLeft = 0.0f; playerOwnedFood = UIController.Food.Nothing; //플레이어가 보유한 음식 비우기. trashgenerator = GameObject.Find("TrashGenerator").GetComponent <TrashGenerator>(); playerbroom = GameObject.Find("BroomSample").GetComponent <PlayerBroom>(); }
void OnTriggerStay(Collider col) { if (col.transform.tag == "Cook") // Cook 영역에 충돌하면 { if (playerOwnedFood != UIController.Food.Nothing) { return; //플레이어가 음식 들고있으면 상호작용 x } if (playerbroom.broomOwn) { return; //플레이어가 빗자루 들고있으면 상호작용 x } if (UIController.CookingState == UIController.CookingPotState.isFoodReady) { playerOwnedFood = UIController.PotFood; //플레이어에게 팟 안에 든 음식 주기 UIController.PotFood = UIController.Food.Nothing; //팟 안을 비우기 UIController.CookingState = UIController.CookingPotState.isPotEmpty; //팟 상태도 비운 상태로 바꾸기 UIController.CookItemZoneLeft = UIController.CookItemType.nothing; //왼쪽 비우기 UIController.CookItemZoneRight = UIController.CookItemType.nothing; //오른쪽 비우기 } } else if (col.transform.tag == "TrashCan") { if (playerOwnedFood == UIController.Food.Nothing) { return; } playerOwnedFood = UIController.Food.Nothing; } else if (col.transform.tag == "Trash") { if (!playerbroom.broomOwn) { return; //플레이어가 빗자루 들고있으면 상호작용 x } for (int i = 0; i < 5; i++) { if (col.transform.position == trashgenerator.randpos[i]) { trashgenerator.randposBool[i] = false; } } Destroy(col.gameObject); } }
// Start is called before the first frame update void Start() { GlobalVariable.currentGuestNum++; nvAgent = this.gameObject.GetComponent <NavMeshAgent>(); targetPos = new Vector3(0, 0, 0); animator = this.gameObject.GetComponent <Animator>(); PlayerLocation = GameObject.Find("Player"); DoorLocation = GameObject.Find("Door"); startPos = transform.position; InventoryInfoScript = GameObject.Find("InventoryInfo").GetComponent("InventoryInfo") as InventoryInfo; guestOrderedFood = (UIController.Food)Random.Range(2, System.Enum.GetValues(typeof(UIController.Food)).Length); orderCount = Random.Range(1, 4); chairIndex = GuestGenerator.currentNum; //랜덤 의자 뽑기 }