コード例 #1
0
    /// <summary>
    /// Combines two Slime Definitions to create one for a Largo
    /// <para>The Identifiable ID for the Largo is Auto Generated</para>
    /// </summary>
    /// <param name="our">Our slime definition</param>
    /// <param name="other">The one to make a Largo with</param>
    /// <returns>The definition or null if it couldn't be created</returns>
    public static SlimeDefinition CombineForLargo(this SlimeDefinition our, SlimeDefinition other)
    {
        if (!other.CanLargofy)
        {
            return(null);
        }

        SlimeDefinition def = ScriptableObject.CreateInstance <SlimeDefinition>();

        def.name = our.name + " " + other.name;

        def.BaseModule = our.BaseModule;
        def.BaseSlimes = new[] { our, other };
        def.CanLargofy = false;

        def.IdentifiableId = SlimeUtils.GetLargoID(our.IdentifiableId, other.IdentifiableId);
        def.IsLargo        = false;

        def.Name        = "Largo " + our.Name + " " + other.Name;
        def.PrefabScale = 2f;

        List <GameObject> modules = new List <GameObject>(our.SlimeModules);

        modules.AddRange(other.SlimeModules);
        def.SlimeModules = modules.ToArray();

        def.AppearancesDefault = our.GetCombinedAppearancesDefault(other.AppearancesDefault);
        def.AppearancesDynamic = our.GetCombinedAppearancesDynamic(other.AppearancesDynamic);
        def.LoadDietFromBaseSlimes();
        def.LoadFavoriteToysFromBaseSlimes();

        def.Sounds = our.Sounds;

        return(def);
    }
コード例 #2
0
 internal override void SetupMod()
 {
     //+-------------------------------
     //+ GENERATE LARGO IDs
     //+-------------------------------
     //SlimeUtils.GenerateLargoIDs(Enums.Identifiables.REAL_GLITCH_SLIME);
     SlimeUtils.GenerateLargoIDs(Enums.Identifiables.ALBINO_SLIME);
 }
コード例 #3
0
        /// <summary>Registers the item into it's registry</summary>
        public override IdentifiableItem Register()
        {
            base.Register();

            SlimeUtils.AddFoodToGroup(ID, SlimeEat.FoodGroup.NONTARRGOLD_SLIMES, IsFavoritedBy);

            return(this);
        }
コード例 #4
0
        /// <summary>Registers the item into it's registry</summary>
        public override IdentifiableItem Register()
        {
            Identifiable.LARGO_CLASS.Add(ID);

            base.Register();

            if (Definition.Diet == null)
            {
                Definition.Diet = new SlimeDiet();
            }

            if (SuperFoods != null)
            {
                FavoriteFoods.AddRange(SuperFoods);
            }

            SlimeDiet diet = Definition.Diet;

            // TODO: Add the new diets
            if (FoodGroups.Contains(SlimeEat.FoodGroup.FRUIT))
            {
                SlimeUtils.PopulateDiet(ID, Identifiable.FRUIT_CLASS, diet, FavoriteFoods, Plort);
                SlimeUtils.PopulateDiet(ID, Identifiable.FRUIT_CLASS, diet, FavoriteFoods, Plort2);
            }

            if (FoodGroups.Contains(SlimeEat.FoodGroup.VEGGIES))
            {
                SlimeUtils.PopulateDiet(ID, Identifiable.VEGGIE_CLASS, diet, FavoriteFoods, Plort);
                SlimeUtils.PopulateDiet(ID, Identifiable.VEGGIE_CLASS, diet, FavoriteFoods, Plort2);
            }

            if (FoodGroups.Contains(SlimeEat.FoodGroup.MEAT))
            {
                SlimeUtils.PopulateDiet(ID, Identifiable.MEAT_CLASS, diet, FavoriteFoods, Plort);
                SlimeUtils.PopulateDiet(ID, Identifiable.MEAT_CLASS, diet, FavoriteFoods, Plort2);
            }

            if (FoodGroups.Contains(SlimeEat.FoodGroup.GINGER))
            {
                SlimeUtils.PopulateDiet(ID, new[] { Identifiable.Id.GINGER_VEGGIE }, diet, FavoriteFoods, Plort);
                SlimeUtils.PopulateDiet(ID, new[] { Identifiable.Id.GINGER_VEGGIE }, diet, FavoriteFoods, Plort2);
            }

            if (FoodGroups.Contains(SlimeEat.FoodGroup.NONTARRGOLD_SLIMES))
            {
                SlimeUtils.PopulateDiet(ID, Identifiable.TOFU_CLASS, diet, FavoriteFoods, Plort);
                SlimeUtils.PopulateDiet(ID, Identifiable.TOFU_CLASS, diet, FavoriteFoods, Plort2);
            }

            // Populates the synergy part
            SlimeUtils.PopulateDiet(ID, SuperFoods, diet, SuperFoods, SynergyPlort);

            return(this);
        }
コード例 #5
0
        /// <summary>Registers the item into it's registry</summary>
        public override IdentifiableItem Register()
        {
            base.Register();

            if (Definition.Diet == null)
            {
                Definition.Diet = new SlimeDiet();
            }

            Definition.Diet.EatMap = new List <SlimeDiet.EatMapEntry>();
            SlimeDiet diet = Definition.Diet;

            if (CustomDietBehaviour || FoodGroups.Count <= 0)
            {
                return(this);
            }

            // TODO: Add the new diets
            if (FoodGroups.Contains(SlimeEat.FoodGroup.FRUIT))
            {
                SlimeUtils.PopulateDiet(ID, Identifiable.FRUIT_CLASS, diet, FavoriteFoods, Plort);
            }

            if (FoodGroups.Contains(SlimeEat.FoodGroup.VEGGIES))
            {
                SlimeUtils.PopulateDiet(ID, Identifiable.VEGGIE_CLASS, diet, FavoriteFoods, Plort);
            }

            if (FoodGroups.Contains(SlimeEat.FoodGroup.MEAT))
            {
                SlimeUtils.PopulateDiet(ID, Identifiable.MEAT_CLASS, diet, FavoriteFoods, Plort);
            }

            if (FoodGroups.Contains(SlimeEat.FoodGroup.GINGER))
            {
                SlimeUtils.PopulateDiet(ID, new[]
                {
                    Identifiable.Id.GINGER_VEGGIE
                }, diet, FavoriteFoods, Plort);
            }

            if (FoodGroups.Contains(SlimeEat.FoodGroup.PLORTS))
            {
                SlimeUtils.PopulateDiet(ID, Identifiable.PLORT_CLASS, diet, FavoriteFoods, Plort, true);
                Definition.CanLargofy = false;
            }

            if (FoodGroups.Contains(SlimeEat.FoodGroup.NONTARRGOLD_SLIMES))
            {
                SlimeUtils.PopulateDiet(ID, Identifiable.TOFU_CLASS, diet, FavoriteFoods, Plort);
            }

            return(this);
        }
コード例 #6
0
        // Injects the favorites into the slime diet or adapts if present
        private static void InjectFavoriteDiet(Identifiable.Id slime, SlimeDiet diet, Identifiable.Id slimeB = Identifiable.Id.NONE)
        {
            if (!FAVORITES.ContainsKey(slime))
            {
                return;
            }

            foreach (Identifiable.Id fav in FAVORITES[slime])
            {
                bool found = false;
                foreach (SlimeDiet.EatMapEntry entry in diet.EatMap.Where(entry => entry.eats == fav))
                {
                    entry.isFavorite = true;
                    entry.favoriteProductionCount = SlimeUtils.DEFAULT_FAV_COUNT;

                    found = true;
                }

                if (found)
                {
                    continue;
                }

                diet.EatMap.Add(new SlimeDiet.EatMapEntry
                {
                    eats       = fav,
                    isFavorite = true,
                    favoriteProductionCount = SlimeUtils.DEFAULT_FAV_COUNT,
                    driver     = SlimeEmotions.Emotion.HUNGER,
                    minDrive   = SlimeUtils.EAT_MIN_DRIVE,
                    producesId = SlimeUtils.SlimeToPlort(slime)
                });

                if (slimeB != Identifiable.Id.NONE)
                {
                    diet.EatMap.Add(new SlimeDiet.EatMapEntry
                    {
                        eats       = fav,
                        isFavorite = true,
                        favoriteProductionCount = SlimeUtils.DEFAULT_FAV_COUNT,
                        driver     = SlimeEmotions.Emotion.HUNGER,
                        minDrive   = SlimeUtils.EAT_MIN_DRIVE,
                        producesId = SlimeUtils.SlimeToPlort(slimeB)
                    });
                }
            }
        }
コード例 #7
0
        /// <summary>Registers the item into it's registry</summary>
        public override IdentifiableItem Register()
        {
            base.Register();

            SlimeUtils.AddFoodToGroup(ID, SlimeEat.FoodGroup.MEAT, IsFavoritedBy);
            SlimeUtils.AddFoodToGroup(ID, SlimeEat.FoodGroup.NONTARRGOLD_SLIMES, IsFavoritedBy);

            Prefab.GetComponent <Reproduce>().childPrefab.GetComponent <TransformAfterTime>().options.Add(
                new TransformAfterTime.TransformOpt()
            {
                targetPrefab = Prefab,
                weight       = 3
            }
                );

            return(this);
        }
コード例 #8
0
        /// <summary>
        /// Adds a specific largo to a slime
        /// </summary>
        /// <param name="slimeA">The slime A to add to</param>
        /// <param name="slimeB">The slime B to add to</param>
        /// <param name="result">The result to generate</param>
        public static void AddSpecificLargo(Identifiable.Id slimeA, Identifiable.Id slimeB, Identifiable.Id result)
        {
            Tuple <Identifiable.Id, Identifiable.Id> mixA = Tuple.Create(SlimeUtils.SlimeToPlort(slimeB), result);
            Tuple <Identifiable.Id, Identifiable.Id> mixB = Tuple.Create(SlimeUtils.SlimeToPlort(slimeA), result);

            if (SPEC_LARGOS.ContainsKey(slimeA))
            {
                SPEC_LARGOS[slimeA] = mixA;
            }
            else
            {
                SPEC_LARGOS.Add(slimeA, mixA);
            }

            if (SPEC_LARGOS.ContainsKey(slimeB))
            {
                SPEC_LARGOS[slimeB] = mixB;
            }
            else
            {
                SPEC_LARGOS.Add(slimeB, mixB);
            }
        }
コード例 #9
0
        /// <summary>Builds this Item</summary>
        protected override void Build()
        {
            //foreach (Identifiable.Id slime in Identifiable.SLIME_CLASS)
            //{
            // Make new Definition
            SlimeDefinition other  = SlimeUtils.GetDefinitionByID(Identifiable.Id.PINK_SLIME);
            SlimeDefinition newDef = Definition.CombineForLargo(other);

            // Translation
            DefTranslation.Add(newDef.IdentifiableId, Regex.Replace(Definition.Name, "(\\B[A-Z])", " $1") + " " + Regex.Replace(other.Name, "(\\B[A-Z])", " $1") + " Largo");

            //if (newDef == null)
            //	continue;

            // Get GameObjects
            Prefab      = PrefabUtils.CopyPrefab(BaseItem);
            Prefab.name = NamePrefix + Definition.Name + other.Name;
            Prefab.transform.localScale = Scale * newDef.PrefabScale;

            // PRIMARY SETUP
            // Load Components
            SlimeAppearanceApplicator app = Prefab.GetComponent <SlimeAppearanceApplicator>();
            SlimeVarietyModules       mod = Prefab.GetComponent <SlimeVarietyModules>();

            // Setup Components
            app.SlimeDefinition = newDef;
            mod.baseModule      = newDef.BaseModule;
            mod.slimeModules    = newDef.SlimeModules;

            mod.Assemble();

            // SECONDARY SETUP
            // Load Components
            SlimeEat    eat = Prefab.GetComponent <SlimeEat>();
            SlimeHealth hp  = Prefab.GetComponent <SlimeHealth>();

            Rigidbody    body = Prefab.GetComponent <Rigidbody>();
            Vacuumable   vac  = Prefab.GetComponent <Vacuumable>();
            Identifiable iden = Prefab.GetComponent <Identifiable>();

            // Setup Components
            eat.slimeDefinition    = newDef;
            eat.minDriveToEat      = MinDriveToEat;
            eat.drivePerEat        = DrivePerEat;
            eat.agitationPerEat    = AgitationPerEat;
            eat.agitationPerFavEat = AgitationPerFavEat;

            hp.maxHealth = Health;

            body.mass = Mass;
            vac.size  = Size;
            iden.id   = newDef.IdentifiableId;

            // TERTIARY SETUP
            // Load Components
            SlimeEmotions emot  = Prefab.GetComponent <SlimeEmotions>();
            SlimeEmotions emot2 = BaseItem.GetComponent <SlimeEmotions>();

            emot.initAgitation = emot2.initAgitation;
            emot.initFear      = emot2.initFear;
            emot.initHunger    = emot2.initHunger;

            // Add to Largo List
            Prefabs.Add(newDef.IdentifiableId, Prefab);
            //}
        }