コード例 #1
0
ファイル: EntityData.cs プロジェクト: ta-david-yu/Game-Maker
    public BehaviourData Clone()
    {
        var clone = new BehaviourData()
        {
            BehaviourSO = BehaviourSO,
            ParamDatas  = new List <BehaviourParamData>()
        };

        for (int i = 0; i < ParamDatas.Count; i++)
        {
            var paramData = ParamDatas[i];
            clone.ParamDatas.Add(paramData.Clone());
        }

        return(clone);
    }
コード例 #2
0
        private static IBehaviour CreateBehaviour(BehaviourData behaviour, ContentChest contentChest)
        {
            if (behaviour == null)
            {
                return(null);
            }

            switch (behaviour.Name)
            {
            case "DoorBehaviour":
                return(new DoorBehaviour
                {
                    OpeningTime = float.Parse(behaviour.GetParameter("OpeningTime"))
                });

            default:
                return(null);
            }
        }
コード例 #3
0
    /// <summary>
    /// Create behaviour data of this type with default values
    /// </summary>
    /// <returns></returns>
    public BehaviourData CreateDefaultBehaviourData()
    {
        var data = new BehaviourData()
        {
            BehaviourSO = this,
            ParamDatas  = new List <BehaviourData.BehaviourParamData>()
        };

        for (int i = 0; i < Parameters.Count; i++)
        {
            var paramType = Parameters[i];
            data.ParamDatas.Add(new BehaviourData.BehaviourParamData()
            {
                BehaviourParamSO = paramType,
                Value            = paramType.DefaultValue
            });
        }

        return(data);
    }
コード例 #4
0
        protected bool TryEat(GameObject preyGameObject, bool holdingByPlayer = false)
        {
            bool          result        = false;
            BehaviourType behaviourType = BehaviourData.GetBehaviourType(preyGameObject);

            if (this.CanEat(behaviourType, holdingByPlayer))
            {
                base.SendMessage("OnFishEat", preyGameObject, SendMessageOptions.DontRequireReceiver);
                float num = 1f;
                if (behaviourType == BehaviourType.MediumFish)
                {
                    num = 1.5f;
                }
                if (behaviourType == BehaviourType.Shark)
                {
                    num = 3f;
                }
                if (preyGameObject.GetComponent <Creature>() != null)
                {
                    UnityEngine.Object.Destroy(preyGameObject);
                }
                this.creature.Hunger.Add(-this.eatHungerDecrement * num);
                this.creature.Happy.Add(this.eatHappyIncrement * num);
                Peeper component = preyGameObject.GetComponent <Peeper>();
                if (component != null && component.isHero)
                {
                    InfectedMixin component2 = base.GetComponent <InfectedMixin>();
                    if (component2 != null)
                    {
                        component2.Heal(0.5f);
                    }
                }
                result = true;
            }
            return(result);
        }
コード例 #5
0
    void Awake()
    {
        GameObject hero = null;

        switch (MyKeys.CurrentSelectedHero)
        {
        case MyKeys.CurrentHero.GuiYuZi:
            hero = StaticParameter.LoadObject("Ninja", "GuiYuZi") as GameObject;
            break;

        case MyKeys.CurrentHero.CiShen:
            hero = StaticParameter.LoadObject("Ninja", "CiShen") as GameObject;
            break;

        case MyKeys.CurrentHero.YuZi:
            hero = StaticParameter.LoadObject("Ninja", "Yuzi") as GameObject;
            break;

        case MyKeys.CurrentHero.ShouSi:
            hero = StaticParameter.LoadObject("Ninja", "Shousi") as GameObject;
            break;
        }

        Instantiate(hero);
        //if (SceneManager.GetActiveScene().name.Contains("Endless"))
        //{
        //    copy.transform.position = new Vector3(-4.2f, -25.3f, 1.06f);
        //}

        //初始化人物属性对象
        _nature = new GameResource.HumanNature(1);

        //初始化行为数据
        _state_Data = new BehaviourData();
        _item_Data  = new ItemColliction();
    }
コード例 #6
0
 public MultishotBehaviour(BehaviourData data, BoardNavigator boardNavigator,
                           List <Validator> validators) : base(data, validators)
 {
     this.boardNavigator = boardNavigator;
 }
コード例 #7
0
ファイル: BetterBehaviour.cs プロジェクト: kimsama/VFW-1
 public void OnBeforeSerialize()
 {
     dLog("Serializing " + GetType().Name);
     BehaviourData.Clear();
     Serializer.SerializeTargetIntoData(this, BehaviourData);
 }
コード例 #8
0
 public void SerializeBehaviour()
 {
     BehaviourData.Clear();
     Serializer.SerializeTargetIntoData(this, BehaviourData);
 }
コード例 #9
0
        public static bool Prefix(LootDistributionData __instance, BiomeType biome, ref bool __result, out LootDistributionData.DstData data)
        {
            if (customDSTDistribution.Count == 0 || Config.RegenSpawns)
            {
                Config.techProbability = new SortedList <string, float>();
                customDSTDistribution  = new SortedDictionary <BiomeType, LootDistributionData.DstData>();
                foreach (BiomeType bio in Enum.GetValues(typeof(BiomeType)))
                {
                    string x = bio.AsString().Split('_').GetLast <string>();
                    techs = new SortedDictionary <TechType, LootDistributionData.PrefabData>();
                    if (__instance.dstDistribution.ContainsKey(bio))
                    {
                        if (!Config.resetDefaults)
                        {
                            foreach (TechType type in Enum.GetValues(typeof(TechType)))
                            {
                                string tech0 = TechTypeExtensions.GetOrFallback(Language.main, type, type) + "| " + bio.AsString().Split('_')[0];
                                if (PlayerPrefs.HasKey(tech0 + ":TechProbability"))
                                {
                                    Config.techProbability[tech0] = PlayerPrefs.GetFloat(tech0 + ":TechProbability");
                                }
                            }
                        }
                        customDSTDistribution[bio]         = new LootDistributionData.DstData();
                        customDSTDistribution[bio].prefabs = new List <LootDistributionData.PrefabData>();

                        foreach (BiomeType b in Enum.GetValues(typeof(BiomeType)))
                        {
                            if (Config.Randomization && __instance.dstDistribution.TryGetValue(b, out var d))
                            {
                                foreach (LootDistributionData.PrefabData prefabData in d.prefabs)
                                {
                                    if (prefabData.classId.ToLower() != "none")
                                    {
                                        WorldEntityInfo wei;
                                        if (WorldEntityDatabase.TryGetInfo(prefabData.classId, out wei) && prefabData.probability > 0 && prefabData.probability < 1)
                                        {
                                            if (!bio.AsString().Contains("Fragment") && wei.slotType == EntitySlot.Type.Creature)
                                            {
                                                if (wei.techType == TechType.ReaperLeviathan)
                                                {
                                                    bool check = false;
                                                    foreach (LootDistributionData.PrefabData prefab in __instance.dstDistribution[bio].prefabs)
                                                    {
                                                        WorldEntityInfo wei2;
                                                        if (WorldEntityDatabase.TryGetInfo(prefab.classId, out wei2))
                                                        {
                                                            if (wei2.techType == TechType.Sandshark ||
                                                                wei2.techType == TechType.BoneShark ||
                                                                wei2.techType == TechType.SpineEel ||
                                                                wei2.techType == TechType.Shocker ||
                                                                wei2.techType == TechType.CrabSquid ||
                                                                wei2.techType == TechType.LavaLizard ||
                                                                wei2.techType == TechType.WarperSpawner)
                                                            {
                                                                check = true;
                                                            }
                                                        }
                                                    }
                                                    if (check)
                                                    {
                                                        if (!techs.ContainsKey(wei.techType))
                                                        {
                                                            if (Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]))
                                                            {
                                                                prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 1000;
                                                                techs[wei.techType]    = prefabData;
                                                                customDSTDistribution[bio].prefabs.Add(prefabData);
                                                                continue;
                                                            }
                                                            else
                                                            {
                                                                techs[wei.techType]    = prefabData;
                                                                prefabData.probability = 0.0025f;
                                                                Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 1000;
                                                                customDSTDistribution[bio].prefabs.Add(prefabData);
                                                                continue;
                                                            }
                                                        }
                                                    }
                                                }
                                                if (wei.techType == TechType.Shocker || wei.techType == TechType.CrabSquid || wei.techType == TechType.WarperSpawner)
                                                {
                                                    bool check = false;
                                                    foreach (LootDistributionData.PrefabData prefab in __instance.dstDistribution[bio].prefabs)
                                                    {
                                                        WorldEntityInfo wei2;
                                                        if (WorldEntityDatabase.TryGetInfo(prefab.classId, out wei2))
                                                        {
                                                            if (wei2.techType == TechType.Sandshark ||
                                                                wei2.techType == TechType.BoneShark ||
                                                                wei2.techType == TechType.SpineEel ||
                                                                wei2.techType == TechType.Shocker ||
                                                                wei2.techType == TechType.CrabSquid ||
                                                                wei2.techType == TechType.Crabsnake ||
                                                                wei2.techType == TechType.LavaLizard)
                                                            {
                                                                check = true;
                                                            }
                                                        }
                                                    }
                                                    if (check)
                                                    {
                                                        if (!techs.ContainsKey(wei.techType))
                                                        {
                                                            if (Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]))
                                                            {
                                                                prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 100;
                                                                techs[wei.techType]    = prefabData;
                                                                customDSTDistribution[bio].prefabs.Add(prefabData);
                                                                continue;
                                                            }
                                                            else
                                                            {
                                                                Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                                                techs[wei.techType] = prefabData;
                                                                customDSTDistribution[bio].prefabs.Add(prefabData);
                                                                continue;
                                                            }
                                                        }
                                                        else
                                                        {
                                                            if (((techs[wei.techType].probability > prefabData.probability && prefabData.count >= techs[wei.techType].count) || (techs[wei.techType].probability >= prefabData.probability && prefabData.count > techs[wei.techType].count)) &&
                                                                prefabData.probability > 0 &&
                                                                prefabData.probability < 1 &&
                                                                prefabData.count > 0)
                                                            {
                                                                Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                                                techs[wei.techType] = prefabData;
                                                                customDSTDistribution[bio].prefabs.Add(prefabData);
                                                                continue;
                                                            }
                                                        }
                                                    }
                                                }
                                                if (wei.techType == TechType.Mesmer)
                                                {
                                                    bool check = false;
                                                    foreach (LootDistributionData.PrefabData prefab in __instance.dstDistribution[bio].prefabs)
                                                    {
                                                        WorldEntityInfo wei2;
                                                        if (WorldEntityDatabase.TryGetInfo(prefabData.classId, out wei2))
                                                        {
                                                            if (BehaviourData.GetBehaviourType(wei2.techType) == BehaviourType.SmallFish ||
                                                                wei2.techType == TechType.Peeper ||
                                                                wei2.techType == TechType.Mesmer)
                                                            {
                                                                check = true;
                                                                break;
                                                            }
                                                        }
                                                    }
                                                    if (check)
                                                    {
                                                        if (!techs.ContainsKey(wei.techType))
                                                        {
                                                            if (Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]))
                                                            {
                                                                prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 100;
                                                                techs[wei.techType]    = prefabData;
                                                                customDSTDistribution[bio].prefabs.Add(prefabData);
                                                                continue;
                                                            }
                                                            else
                                                            {
                                                                Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                                                techs[wei.techType] = prefabData;
                                                                customDSTDistribution[bio].prefabs.Add(prefabData);
                                                                continue;
                                                            }
                                                        }
                                                        else
                                                        {
                                                            if (((techs[wei.techType].probability > prefabData.probability && prefabData.count >= techs[wei.techType].count) || (techs[wei.techType].probability >= prefabData.probability && prefabData.count > techs[wei.techType].count)) &&
                                                                prefabData.probability > 0 &&
                                                                prefabData.probability < 1 &&
                                                                prefabData.count > 0)
                                                            {
                                                                Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                                                techs[wei.techType] = prefabData;
                                                                customDSTDistribution[bio].prefabs.Add(prefabData);
                                                                continue;
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            else if (wei.techType != TechType.None && !bio.AsString().Contains("Fragment") && wei.techType.AsString().Contains("Chunk"))
                                            {
                                                bool check = false;
                                                foreach (LootDistributionData.PrefabData prefab in __instance.dstDistribution[bio].prefabs)
                                                {
                                                    WorldEntityInfo wei2;
                                                    if (WorldEntityDatabase.TryGetInfo(prefab.classId, out wei2))
                                                    {
                                                        if (wei2.techType == TechType.LimestoneChunk ||
                                                            wei2.techType == TechType.SandstoneChunk ||
                                                            wei2.techType == TechType.ShaleChunk)
                                                        {
                                                            check = true;
                                                            break;
                                                        }
                                                    }
                                                }
                                                if (check)
                                                {
                                                    if (!techs.ContainsKey(wei.techType))
                                                    {
                                                        if (Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]))
                                                        {
                                                            prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 100;
                                                            techs[wei.techType]    = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                        else
                                                        {
                                                            Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                                            techs[wei.techType] = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (((techs[wei.techType].probability > prefabData.probability && prefabData.count >= techs[wei.techType].count) || (techs[wei.techType].probability >= prefabData.probability && prefabData.count > techs[wei.techType].count)) &&
                                                            prefabData.probability > 0 &&
                                                            prefabData.probability < 1 &&
                                                            prefabData.count > 0)
                                                        {
                                                            Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                                            techs[wei.techType] = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                    }
                                                }
                                            }
                                            else if (wei.techType != TechType.None && !bio.AsString().Contains("Fragment") && (wei.techType == TechType.AluminumOxide ||
                                                                                                                               wei.techType == TechType.BloodOil ||
                                                                                                                               wei.techType == TechType.Sulphur ||
                                                                                                                               wei.techType == TechType.Diamond ||
                                                                                                                               wei.techType == TechType.Kyanite ||
                                                                                                                               wei.techType == TechType.Lead ||
                                                                                                                               wei.techType == TechType.Lithium ||
                                                                                                                               wei.techType == TechType.Magnetite ||
                                                                                                                               wei.techType == TechType.Nickel ||
                                                                                                                               wei.techType == TechType.Quartz ||
                                                                                                                               wei.techType == TechType.Silver))
                                            {
                                                bool check = false;
                                                foreach (LootDistributionData.PrefabData prefab in __instance.dstDistribution[bio].prefabs)
                                                {
                                                    WorldEntityInfo wei2;
                                                    if (WorldEntityDatabase.TryGetInfo(prefab.classId, out wei2))
                                                    {
                                                        if (wei2.techType == TechType.AluminumOxide ||
                                                            wei2.techType == TechType.BloodOil ||
                                                            wei2.techType == TechType.Sulphur ||
                                                            wei2.techType == TechType.Diamond ||
                                                            wei2.techType == TechType.Kyanite ||
                                                            wei2.techType == TechType.Lead ||
                                                            wei2.techType == TechType.Lithium ||
                                                            wei2.techType == TechType.Magnetite ||
                                                            wei2.techType == TechType.Nickel ||
                                                            wei2.techType == TechType.Salt ||
                                                            wei2.techType == TechType.Silver)
                                                        {
                                                            check = true;
                                                            break;
                                                        }
                                                    }
                                                }

                                                if (check)
                                                {
                                                    if (!techs.ContainsKey(wei.techType))
                                                    {
                                                        if (Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]))
                                                        {
                                                            prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 100;
                                                            techs[wei.techType]    = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                        else
                                                        {
                                                            Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                                            techs[wei.techType] = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (((techs[wei.techType].probability > prefabData.probability && prefabData.count >= techs[wei.techType].count) || (techs[wei.techType].probability >= prefabData.probability && prefabData.count > techs[wei.techType].count)) &&
                                                            prefabData.probability > 0 &&
                                                            prefabData.probability < 1 &&
                                                            prefabData.count > 0)
                                                        {
                                                            Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                                            techs[wei.techType] = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                    }
                                                }
                                            }
                                            else if (wei.techType != TechType.None && !bio.AsString().Contains("Fragment") && wei.techType.AsString().Contains("Drillable"))
                                            {
                                                bool check = false;
                                                foreach (LootDistributionData.PrefabData prefab in __instance.dstDistribution[bio].prefabs)
                                                {
                                                    WorldEntityInfo wei2;
                                                    if (WorldEntityDatabase.TryGetInfo(prefab.classId, out wei2))
                                                    {
                                                        if (wei2.techType.AsString().Contains("Drillable"))
                                                        {
                                                            check = true;
                                                            break;
                                                        }
                                                    }
                                                }

                                                if (check)
                                                {
                                                    if (!techs.ContainsKey(wei.techType))
                                                    {
                                                        if (Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]))
                                                        {
                                                            prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 100;
                                                            techs[wei.techType]    = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                        else
                                                        {
                                                            Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                                            techs[wei.techType] = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (((techs[wei.techType].probability > prefabData.probability && prefabData.count >= techs[wei.techType].count) || (techs[wei.techType].probability >= prefabData.probability && prefabData.count > techs[wei.techType].count)) &&
                                                            prefabData.probability > 0 &&
                                                            prefabData.probability < 1 &&
                                                            prefabData.count > 0)
                                                        {
                                                            Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                                            techs[wei.techType] = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                    }
                                                }
                                            }
                                            else if (((!bio.AsString().Contains("Fragment") &&
                                                       !b.AsString().Contains("Fragment")) || (bio.AsString().Contains("Fragment") &&
                                                                                               b.AsString().Contains("Fragment"))) &&
                                                     wei.techType.AsString().Contains("Fragment"))
                                            {
                                                bool check = false;
                                                foreach (LootDistributionData.PrefabData prefab in __instance.dstDistribution[bio].prefabs)
                                                {
                                                    WorldEntityInfo wei2;
                                                    if (WorldEntityDatabase.TryGetInfo(prefab.classId, out wei2))
                                                    {
                                                        if (wei2.techType.AsString().Contains("Fragment"))
                                                        {
                                                            check = true;
                                                            break;
                                                        }
                                                    }
                                                }

                                                if (check)
                                                {
                                                    if (!techs.ContainsKey(wei.techType))
                                                    {
                                                        if (Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]))
                                                        {
                                                            prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 100;
                                                            techs[wei.techType]    = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                        else
                                                        {
                                                            Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                                            techs[wei.techType] = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (((techs[wei.techType].probability > prefabData.probability && prefabData.count >= techs[wei.techType].count) || (techs[wei.techType].probability >= prefabData.probability && prefabData.count > techs[wei.techType].count)) &&
                                                            prefabData.probability > 0 &&
                                                            prefabData.probability < 1 &&
                                                            prefabData.count > 0 &&
                                                            !bio.AsString().Contains("Fragment") &&
                                                            !b.AsString().Contains("Fragment"))
                                                        {
                                                            Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                                            techs[wei.techType] = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                    }
                                                }
                                            }
                                            else if (!bio.AsString().Contains("Fragment") && wei.techType == TechType.TimeCapsule)
                                            {
                                                bool check = false;
                                                foreach (LootDistributionData.PrefabData prefab in __instance.dstDistribution[b].prefabs)
                                                {
                                                    WorldEntityInfo wei2;
                                                    if (WorldEntityDatabase.TryGetInfo(prefab.classId, out wei2))
                                                    {
                                                        if (wei2.techType.AsString().Contains("Fragment"))
                                                        {
                                                            check = true;
                                                            break;
                                                        }
                                                    }
                                                }
                                                if (check)
                                                {
                                                    if (!techs.ContainsKey(wei.techType))
                                                    {
                                                        if (Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]))
                                                        {
                                                            prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 1000;
                                                            techs[wei.techType]    = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                        else
                                                        {
                                                            Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 1000;
                                                            techs[wei.techType] = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (((techs[wei.techType].probability > prefabData.probability && prefabData.count >= techs[wei.techType].count) || (techs[wei.techType].probability >= prefabData.probability && prefabData.count > techs[wei.techType].count)) &&
                                                            prefabData.probability > 0 &&
                                                            prefabData.probability < 1 &&
                                                            prefabData.count > 0)
                                                        {
                                                            Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 1000;
                                                            techs[wei.techType] = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        foreach (LootDistributionData.PrefabData prefabData in __instance.dstDistribution[bio].prefabs)
                        {
                            WorldEntityInfo wei;
                            if (WorldEntityDatabase.TryGetInfo(prefabData.classId, out wei) && prefabData.probability > 0 && prefabData.probability < 1)
                            {
                                if (wei.techType != TechType.None)
                                {
                                    if (!Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]))
                                    {
                                        Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                        techs[wei.techType] = prefabData;
                                        customDSTDistribution[bio].prefabs.Add(prefabData);
                                        continue;
                                    }
                                    else
                                    {
                                        prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 100;
                                        techs[wei.techType]    = prefabData;
                                        customDSTDistribution[bio].prefabs.Add(prefabData);
                                        continue;
                                    }
                                }
                                else
                                {
                                    customDSTDistribution[bio].prefabs.Add(prefabData);
                                    continue;
                                }
                            }
                            else
                            {
                                customDSTDistribution[bio].prefabs.Add(prefabData);
                            }
                        }
                    }
                }
                if (Config.RegenSpawns)
                {
                    Config.resetDefaults = false;
                    Config.RegenSpawns   = false;
                    IngameMenu.main.Open();
                    IngameMenu.main.ChangeSubscreen("Options");
                }
            }

            __result = customDSTDistribution.TryGetValue(biome, out data);
            return(!(__result));
        }
コード例 #10
0
        public virtual bool CanEat(BehaviourType behaviourType, bool holdingByPlayer = false)
        {
            BehaviourType behaviourType2 = BehaviourData.GetBehaviourType(base.gameObject);

            return(behaviourType == BehaviourType.SmallFish || (behaviourType == BehaviourType.MediumFish && (holdingByPlayer || behaviourType2 == BehaviourType.Shark)));
        }
コード例 #11
0
 public MarkerBehaviour(BehaviourData data, List <Validator> validators) : base(data, validators)
 {
 }