Пример #1
0
 /// <summary>
 /// 设置顾客数据
 /// </summary>
 /// <param name="npcAICustomer"></param>
 public void SetDataForCustomerFood(NpcAICustomerCpt npcAICustomer)
 {
     this.targetNpcAIForCustomerFood = npcAICustomer;
     //设置类型
     if (npcAICustomer.GetOrderForCustomer() == null)
     {
         SetType(TextHandler.Instance.manager.GetTextById(70));
     }
     else
     {
         SetType(TextHandler.Instance.manager.GetTextById(60));
         //设置状态
         objNpcStatus.SetActive(true);
         npcAICustomer.GetCustomerStatus(out string customerStatus);
         SetStatus(customerStatus);
     }
     //设置好友
     if (npcAICustomer as NpcAICostomerForFriendCpt)
     {
         objFriend.SetActive(true);
     }
     //设置团队
     if (npcAICustomer as NpcAICustomerForGuestTeamCpt)
     {
         NpcAICustomerForGuestTeamCpt npcTeam = (NpcAICustomerForGuestTeamCpt)npcAICustomer;
         if (!CheckUtil.StringIsNull(npcTeam.teamCode))
         {
             objTeam.SetActive(true);
             ivTeam.color    = npcTeam.teamColor;
             tvTeamName.text = TextHandler.Instance.manager.GetTextById(49) + ":" + npcTeam.teamData.name;
         }
     }
     ShowCustomerFoodData();
 }
Пример #2
0
    public void BuildGuestTeam(NpcTeamBean npcTeam, Vector3 npcPosition)
    {
        if (npcTeam == null)
        {
            return;
        }
        //设置小队相关
        string teamCode  = SystemUtil.GetUUID(SystemUtil.UUIDTypeEnum.N);
        Color  teamColor = new Color(UnityEngine.Random.Range(0f, 1f), UnityEngine.Random.Range(0f, 1f), UnityEngine.Random.Range(0f, 1f));
        //设置是否想吃
        bool isWant = IsWantEat(CustomerTypeEnum.Team);

        //获取小队成员数据
        npcTeam.GetTeamCharacterData(out List <CharacterBean> listLeader, out List <CharacterBean> listMembers);
        //设置小队人数(团队领袖全生成,小队成员随机生成)
        int npcNumber = UnityEngine.Random.Range(listLeader.Count + 1, listLeader.Count + 1 + npcTeam.team_number);

        for (int i = 0; i < npcNumber; i++)
        {
            CharacterBean characterData = null;
            if (i < listLeader.Count)
            {
                characterData = listLeader[i];
            }
            else
            {
                characterData = RandomUtil.GetRandomDataByList(listMembers);
            }
            //如果发现成员数据为空 默认取领导的
            if (characterData == null)
            {
                characterData = listLeader[0];
            }
            //随机生成身体数据
            characterData.body.CreateRandomEye();


            GameObject npcObj    = BuildNpc(listGuestTeamHide, objGuestTeamModel, characterData, npcPosition + new Vector3(UnityEngine.Random.Range(-0.5f, 0.5f), UnityEngine.Random.Range(-0.5f, 0.5f)));
            BaseNpcAI  baseNpcAI = npcObj.GetComponent <BaseNpcAI>();
            baseNpcAI.SetCharacterData(characterData);
            baseNpcAI.AddStatusIconForGuestTeam(teamColor);
            NpcAICustomerForGuestTeamCpt customerAI = baseNpcAI.GetComponent <NpcAICustomerForGuestTeamCpt>();
            customerAI.SetTeamData(teamCode, npcTeam, i, teamColor);
            if (GameTimeHandler.Instance.GetDayStatus() == GameTimeHandler.DayEnum.Work && isWant)
            {
                customerAI.SetIntent(NpcAICustomerCpt.CustomerIntentEnum.Want);
            }
            else
            {
                customerAI.SetIntent(NpcAICustomerCpt.CustomerIntentEnum.Walk);
            }
        }
    }