/// <summary> /// 开始制造麻烦 /// </summary> /// <returns></returns> public IEnumerator CoroutineForStartMakeTrouble() { while (rascalIntent == RascalIntentEnum.MakeTrouble || rascalIntent == RascalIntentEnum.ContinueMakeTrouble) { if (isMove) { movePosition = InnHandler.Instance.GetRandomInnPositon(); bool canGo = CheckUtil.CheckPath(transform.position, movePosition); if (canGo) { characterMoveCpt.SetDestination(movePosition); } } //随机获取一句喊话 //int shoutId = Random.Range(13101, 13106); if (!CheckUtil.ListIsNull(listShoutTextInfo)) { TextInfoBean textInfo = RandomUtil.GetRandomDataByList(listShoutTextInfo); characterShoutCpt.Shout(textInfo.content); } yield return(new WaitForSeconds(5)); //时间到了就离开 timeMakeTrouble -= 5; if (timeMakeTrouble <= 0) { SetIntent(RascalIntentEnum.Leave); } } }
/// <summary> /// 分配厨师做饭 /// </summary> public bool SetChefForCook(OrderForCustomer orderForCustomer, NpcAIWorkerCpt chefCpt) { BuildStoveCpt stoveCpt = null; if (chefCpt == null) { return(false); } for (int i = 0; i < listStoveCpt.Count; i++) { BuildStoveCpt itemStove = listStoveCpt[i]; //检测是否能到达烹饪点 if (itemStove.stoveStatus == BuildStoveCpt.StoveStatusEnum.Idle && CheckUtil.CheckPath(chefCpt.transform.position, itemStove.GetCookPosition())) { stoveCpt = itemStove; break; } } if (chefCpt != null && stoveCpt != null) { orderForCustomer.stove = stoveCpt; orderForCustomer.stove.SetStoveStatus(BuildStoveCpt.StoveStatusEnum.Ready); orderForCustomer.chef = chefCpt; chefCpt.SetIntent(NpcAIWorkerCpt.WorkerIntentEnum.Cook, orderForCustomer); return(true); } else { return(false); } }
/// <summary> /// 意图-前往餐桌 /// </summary> /// <param name="buildTableCpt"></param> public void IntentForGoToSeat(OrderForCustomer orderForCustomer) { //停止等待 if (gameObject == null) { return; } StopAllCoroutines(); this.orderForCustomer = orderForCustomer; //判断路径是否有效 if (CheckUtil.CheckPath(transform.position, orderForCustomer.table.GetSeatPosition())) { //开启满意度 characterMoodCpt.SetMood(orderForCustomer.innEvaluation.GetPraise()); //前往桌子 movePosition = orderForCustomer.table.GetSeatPosition(); characterMoveCpt.SetDestination(movePosition); //记录该顾客 InnHandler.Instance.RecordCustomer(orderForCustomer); } else { SetMood(30); EndOrderAndLeave(); } }
/// <summary> /// 获取最近的楼梯 /// </summary> /// <param name="position"></param> /// <returns></returns> public BuildStairsCpt GetCloseStairs(Vector3 position) { if (CheckUtil.ListIsNull(listStairsCpt)) { return(null); } float tempDistance = float.MaxValue; BuildStairsCpt closeStairs = null; for (int i = 0; i < listStairsCpt.Count; i++) { BuildStairsCpt buildStairs = listStairsCpt[i]; //如果不能到达则不用 if (!CheckUtil.CheckPath(position, buildStairs.GetStairsPosition())) { continue; } float itemDistance = Vector3.Distance(position, buildStairs.GetStairsPosition()); if (tempDistance > itemDistance) { closeStairs = buildStairs; tempDistance = itemDistance; } } return(closeStairs); }
protected void SetIntentIdle() { //闲逛 有问题 Vector3 movePosition = InnHandler.Instance.GetRandomInnPositon(); bool canGo = CheckUtil.CheckPath(transform.position, movePosition); if (canGo) { SetCharacterMove(movePosition); } StartCoroutine(CoroutineForIdle()); }
/// <summary> /// 前往床 /// </summary> public void IntentForGoToBed() { Vector3 sleepPosition = orderForHotel.bed.GetSleepPosition(); if (!CheckUtil.CheckPath(sleepPosition, transform.position)) { InnHandler.Instance.EndOrderForForce(orderForHotel, true); SetIntent(CustomerHotelIntentEnum.GoToStairsForSecond); return; } SetCharacterMove(sleepPosition); }
/// <summary> /// 前往床 /// </summary> public void SetIntentForGoToBed() { Vector3 sleepPosition = orderForHotel.bed.GetSleepPosition(); if (!CheckUtil.CheckPath(sleepPosition, transform.position)) { //不能到达 npcAIWorker.SetShout(TextHandler.Instance.manager.GetTextById(13405)); SetIntent(AccostIntentEnum.GoToStairsForSecond); return; } npcAIWorker.SetCharacterMove(sleepPosition); }
/// <summary> /// 意图-前往取餐 /// </summary> /// <param name="orderForCustomer"></param> public void SetIntentForGoToGetFood(OrderForCustomer orderForCustomer) { if (CheckUtil.CheckPath(transform.position, orderForCustomer.stove.GetTakeFoodPosition())) { sendPro.SetActive(true); movePosition = orderForCustomer.stove.GetTakeFoodPosition(); npcAIWorker.characterMoveCpt.SetDestination(movePosition); } else { SetIntent(WaiterIntentEnum.Idle); } }
/// <summary> /// 意图-前往结算 /// </summary> /// <param name="order"></param> public void SetIntentForGoToAccounting(OrderForBase order) { if (CheckUtil.CheckPath(transform.position, order.counter.GetAccountingPosition())) { accountingPro.SetActive(true); movePosition = order.counter.GetAccountingPosition(); npcAIWorker.characterMoveCpt.SetDestination(movePosition); } else { SetIntent(AccountantIntentEnum.Idle); } }
public void HandleForDisappointed() { if (convertIntent == ConvertIntentEnum.Disappointed) { if (CheckCharacterIsArrive()) { movePosition = InnHandler.Instance.GetRandomInnPositon(); if (CheckUtil.CheckPath(transform.position, movePosition)) { SetCharacterMove(movePosition); } } } }
/// <summary> /// 设置闲置 /// </summary> public void SetIntentForIdle() { //有一定概率发呆 if (dazeEnabled && dazeBufferTime <= 0 && characterData.CalculationWorkerDaze()) { SetIntent(WorkerIntentEnum.Daze); } else { //闲逛或者待在原地 int action = UnityEngine.Random.Range(0, 5); if (action == 0) { //闲逛 有问题 Vector3 movePosition = InnHandler.Instance.GetRandomInnPositon(); bool canGo = CheckUtil.CheckPath(transform.position, movePosition); if (canGo) { SetCharacterMove(movePosition); } } StartCoroutine(CoroutineForIdle()); } }