Пример #1
0
        private static Dictionary <ETalkLevel, Item> GetPlyerHealthCase()
        {
            Dictionary <ETalkLevel, Item> items = new Dictionary <ETalkLevel, Item>();

            items[ETalkLevel.Medium] = NpcRandomTalkDb.Get((int)ENpcTalkType.MainPlayer_health_medium);
            items[ETalkLevel.Low]    = NpcRandomTalkDb.Get((int)ENpcTalkType.MainPlayer_health_low);
            return(items);
        }
Пример #2
0
 public AgentInfo(ENpcTalkType type, ENpcSpeakType spType, bool canLoop = false)
 {
     _type      = type;
     _spType    = spType;
     _startTime = Time.time;
     _canLoop   = canLoop;
     _loopTime  = NpcRandomTalkDb.Get(type)._interval;
 }
Пример #3
0
        private static Dictionary <ETalkLevel, Item> GetHungerCase()
        {
            Dictionary <ETalkLevel, Item> items = new Dictionary <ETalkLevel, Item>();

            items[ETalkLevel.Medium] = NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_hunger_medium);
            items[ETalkLevel.Low]    = NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_hunger_low);
            return(items);
        }
Пример #4
0
        private static Dictionary <ETalkLevel, Item> GetPlyerComfortCase()
        {
            Dictionary <ETalkLevel, Item> items = new Dictionary <ETalkLevel, Item>();

            items[ETalkLevel.Common] = NpcRandomTalkDb.Get((int)ENpcTalkType.MainPlayer_comfort_common);
            items[ETalkLevel.Medium] = NpcRandomTalkDb.Get((int)ENpcTalkType.MainPlayer_comfort_medium);
            items[ETalkLevel.Low]    = NpcRandomTalkDb.Get((int)ENpcTalkType.MainPlayer_comfort_low);
            return(items);
        }
Пример #5
0
        public void RunAttrAgent(PeEntity peEntity)
        {
            //npc self
            List <NpcRandomTalkDb.Item> Items = NpcRandomTalkDb.GetTalkItems(peEntity);

            for (int i = 0; i < Items.Count; i++)
            {
                if (Items[i] == null || Items[i].Type == AttribType.Max || Items[i].Level == ETalkLevel.Max)
                {
                    continue;
                }

                if (!NpcEatDb.CanEatByAttr(peEntity, Items[i].Type, Items[i].TypeMax, false))
                {
                    AddAgentInfo(new AgentInfo(Items[i].TalkType, ENpcSpeakType.TopHead, true));
                }
            }


            //ask for Player
//			PeEntity palyer = null;
//			//int playerID = (int)peEntity.GetAttribute (AttribType.DefaultPlayerID);
//			if (GameConfig.IsMultiClient)
//			{
//				//get main palyer peEntity
//			}
//			else
//			{
//				if (PeCreature.Instance != null)
//				{
//					palyer = PeCreature.Instance.mainPlayer;
//				}
//			}

//			if(palyer != null)
//			{
//				Items = NpcRandomTalkDb.GetPlyerTalkItems(palyer);
//				for (int i = 0; i < Items.Count; i++)
//				{
//					if (Items[i] == null || Items[i].Type == AttribType.Max || Items[i].Level == ETalkLevel.Max)
//						continue;
//
//					AddAgentInfo(new AgentInfo(Items[i].TalkType,ENpcSpeakType.TopHead,true));
//				}
//			}
//
//			NpcRandomTalkDb.Item item = NpcRandomTalkDb.Get(ENpcTalkType.Day_to_day);
//			AddAgentInfo(new AgentInfo(item.TalkType,ENpcSpeakType.TopHead,true));

            RunAgent();
        }
Пример #6
0
        public static int GetTalkCase(int id)
        {
            NpcRandomTalkDb.Item item = NpcRandomTalkDb.Get(id);
            if (item == null)
            {
                return(-1);
            }

            if (UnityEngine.Random.value <= item._probability)
            {
                return(item.Scenario.RandCase());
            }
            return(-1);
        }
Пример #7
0
        public static int GetTalkCase(int id, out float time)
        {
            time = 0.0f;
            NpcRandomTalkDb.Item item = NpcRandomTalkDb.Get(id);
            if (item == null)
            {
                return(-1);
            }

            if (UnityEngine.Random.value <= item._probability)
            {
                time = item._interval;
                return(item.Scenario.RandCase());
            }
            return(-1);
        }
Пример #8
0
        public static int CheckAttrbCase(PESkEntity peskentity)
        {
            RandomAttrChoce attr     = new RandomAttrChoce();
            AttribType      type     = attr.RandType();
            float           curvalue = peskentity.GetAttribute(type);

            switch (type)
            {
            case AttribType.Hunger:
            {
                float maxHunger = peskentity.GetAttribute(AttribType.HungerMax);

                if (curvalue <= maxHunger * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_hunger_medium)._value &&
                    curvalue > maxHunger * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_hunger_low)._value)
                {
                    return(NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_hunger_medium).Scenario.RandCase());
                }
                else if (curvalue <= maxHunger * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_health_low)._value)
                {
                    return(NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_hunger_low).Scenario.RandCase());
                }
                else
                {
                    return(-1);
                }
            }

            //	break;
            case AttribType.Hp:
            {
                float maxHp = peskentity.GetAttribute(AttribType.HpMax);
                if (curvalue <= maxHp * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_health_medium)._value &&
                    curvalue > maxHp * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_health_low)._value)
                {
                    return(NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_health_medium).Scenario.RandCase());
                }
                else if (curvalue <= maxHp * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_health_low)._value)
                {
                    return(NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_health_low).Scenario.RandCase());
                }
                else
                {
                    return(-1);
                }
            }

            //	break;
            case AttribType.Comfort:
            {
                float maxcomfort = peskentity.GetAttribute(AttribType.ComfortMax);
                if (curvalue <= maxcomfort * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_comfort_common)._value &&
                    curvalue > maxcomfort * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_comfort_medium)._value)
                {
                    return(NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_comfort_common).Scenario.RandCase());
                }
                else if (curvalue <= maxcomfort * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_comfort_medium)._value &&
                         curvalue > maxcomfort * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_comfort_low)._value
                         )
                {
                    return(NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_comfort_medium).Scenario.RandCase());
                }
                else if (curvalue <= maxcomfort * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_comfort_low)._value)
                {
                    return(NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_comfort_low).Scenario.RandCase());
                }
                else
                {
                    return(-1);
                }
            }
            //	break;

            default:
                break;
            }
            return(-1);
        }