| | |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using Codice.Client.Common; |
| | | using LitJson; |
| | | using UnityEngine; |
| | | |
| | |
| | | public List<int> guildTalkIndexList = new List<int>(); |
| | | public float lastGuildTalkTime; |
| | | public int lastGuildRandomIndex; |
| | | |
| | | //行商特殊处理 |
| | | public bool isHawkerShowNow = false; //行商状态,true 行商走出来和站岗中,false 行商走出去和外出中 |
| | | public bool isHawkerStandBy = false; //行商状态,true 行商站岗中,只有true才能参与喊话;移动或者消失都为false |
| | | |
| | | |
| | | public override void Init() |
| | |
| | | |
| | | public int GetRandomGuildNpcTalk() |
| | | { |
| | | int index = Random.Range(0, guildTalkIndexList.Count); |
| | | //行商特殊处理,行商非站岗中不参与喊话 |
| | | int index; |
| | | if (isHawkerStandBy) |
| | | { |
| | | index = Random.Range(0, guildTalkIndexList.Count); |
| | | } |
| | | else |
| | | { |
| | | if (guildTalkIndexList.Count == 1) |
| | | { |
| | | return -1; |
| | | } |
| | | index = Random.Range(1, guildTalkIndexList.Count); |
| | | } |
| | | if (index == lastGuildRandomIndex) |
| | | { |
| | | if (guildTalkIndexList.Count == 1) |
| | | { |
| | | //只有一个的情况 |
| | | lastGuildRandomIndex = -1; |
| | | return -1; |
| | | } |
| | | index = (index + 1) % guildTalkIndexList.Count; |
| | | } |
| | | lastGuildRandomIndex = index; |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public string GetGuildTalk(int skinID) |
| | | { |
| | | if (guildNpcTalkDic.ContainsKey(skinID)) |
| | | { |
| | | return guildNpcTalkDic[skinID][Random.Range(0, guildNpcTalkDic[skinID].Length)]; |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | |