コード例 #1
0
        public override string CommunicateRandomInfo()
        {
            DefaultStatStringChain.Clear();

            int  randomRelevantStatIndex = Random.Range(0, MyObjectInfoTemplate.RelevantObjectStats.Count);
            Stat targetStat = infoWorldObject.ObjectCreature.Stats.FindStat(MyObjectInfoTemplate.RelevantObjectStats[randomRelevantStatIndex].statType);

            string statInsert     = targetStat.statType.ToString();
            string statInfoInsert = HumanizeTypes.Humanize(targetStat.CurrentValue, targetStat.statType, out HumanizeEnum humanizeEnum);

            if (humanizeEnum == HumanizeEnum.NewPhrase)
            {
                DefaultStatStringChain.Add(new SerializedDictionaryEntry_StringChain(statInfoInsert, 2));

                DefaultStatStringChain.Add(new SerializedDictionaryEntry_StringChain(infoWorldObject.ObjectCreature.CharacterName, 0));
                DefaultStatStringChain.Add(new SerializedDictionaryEntry_StringChain(" is ", 1));
            }
            else
            {
                DefaultStatStringChain.Add(new SerializedDictionaryEntry_StringChain(statInsert, 1));
                DefaultStatStringChain.Add(new SerializedDictionaryEntry_StringChain(statInfoInsert, 3));

                DefaultStatStringChain.Add(new SerializedDictionaryEntry_StringChain(infoWorldObject.ObjectCreature.CharacterName + "'s ", 0));
                DefaultStatStringChain.Add(new SerializedDictionaryEntry_StringChain(" is ", 2));
            }

            string finalStatString = Utils.BuildStringChain(DefaultStatStringChain);

            return(finalStatString);
        }
コード例 #2
0
        public override string CommunicateRandomInfo()
        {
            DefaultAbundanceListStringChain.Clear();
            DefaultCrowdednessStringChain.Clear();

            int randomLocationInfoType = UnityEngine.Random.Range(0, 2);

            string locationInsert = MyLocation.LocationName;

            switch (randomLocationInfoType)
            {
            case 0:
                string crowdednessInsert = HumanizeTypes.HumanizeLowHigh(MyLocation.Crowdedness);

                DefaultCrowdednessStringChain.Add(new SerializedDictionaryEntry_StringChain("Crowdedness", 1));
                DefaultCrowdednessStringChain.Add(new SerializedDictionaryEntry_StringChain(crowdednessInsert, 3));

                DefaultCrowdednessStringChain.Add(new SerializedDictionaryEntry_StringChain(locationInsert + "'s ", 0));
                DefaultCrowdednessStringChain.Add(new SerializedDictionaryEntry_StringChain(" is ", 2));

                string finalCrowdednessString = Utils.BuildStringChain(DefaultCrowdednessStringChain);
                return(finalCrowdednessString);

            case 1:
                int            randomRelevantResourceIndex = Random.Range(0, MyLocation.AbundanceData.ResourceList.Count);
                ResourceDataSO targetResourceAbundance     = MyLocation.AbundanceData.ResourceList[randomRelevantResourceIndex];

                string resourceInsert     = targetResourceAbundance.Item.ItemName;
                string resourceInfoInsert = HumanizeTypes.HumanizeLowHigh(targetResourceAbundance.AbundanceValue);

                DefaultAbundanceListStringChain.Add(new SerializedDictionaryEntry_StringChain(resourceInsert + " stock", 1));
                DefaultAbundanceListStringChain.Add(new SerializedDictionaryEntry_StringChain(resourceInfoInsert, 3));

                DefaultAbundanceListStringChain.Add(new SerializedDictionaryEntry_StringChain(locationInsert + "'s ", 0));
                DefaultAbundanceListStringChain.Add(new SerializedDictionaryEntry_StringChain(" is ", 2));

                string finalAbundanceListString = Utils.BuildStringChain(DefaultAbundanceListStringChain);
                return(finalAbundanceListString);
            }

            return("I don't know...");
        }