예제 #1
0
        internal static void AddSimpleVariant(string bodyName, float spawnRate, MonsterVariantTier tier, MonsterSizeModifier size, float health, float moveSpeed, float attackSpeed, float damage, float armor, float armorBonus, int alienHeads, Material replacementMaterial, Mesh replacementMesh)
        {
            MonsterMaterialReplacement[] replacementMats = null;
            if (replacementMaterial != null)
            {
                replacementMats = SimpleMaterialReplacement(replacementMaterial);
            }

            MonsterVariantInfo newInfo = new MonsterVariantInfo
            {
                bodyName              = bodyName,
                spawnRate             = spawnRate,
                variantTier           = tier,
                sizeModifier          = size,
                healthMultiplier      = health,
                moveSpeedMultiplier   = moveSpeed,
                attackSpeedMultiplier = attackSpeed,
                damageMultiplier      = damage,
                armorMultiplier       = armor,
                armorBonus            = armorBonus,
                customInventory       = SimpleInventory("AlienHead", alienHeads),
                meshReplacement       = null,
                materialReplacement   = replacementMats,
                skillReplacement      = null,
                buff = BuffIndex.None
            };

            Components.VariantHandler variantHandler = Resources.Load <GameObject>("Prefabs/CharacterBodies/" + bodyName + "Body").AddComponent <Components.VariantHandler>();
            variantHandler.Init(newInfo);
        }
예제 #2
0
        public static void AddVariant(GameObject bodyPrefab, MonsterVariantInfo info)
        {
            if (!bodyPrefab)
            {
                Debug.LogError("Failed to add variant: Invalid body prefab");
                return;
            }

            Components.VariantHandler variantHandler = bodyPrefab.AddComponent <Components.VariantHandler>();
            variantHandler.Init(info);
        }
예제 #3
0
        public static void AddModdedVariant(MonsterVariantInfo info)
        {
            On.RoR2.BodyCatalog.Init += (orig) =>
            {
                orig();

                GameObject bodyPrefab = BodyCatalog.FindBodyPrefab(info.bodyName + "Body");
                if (!bodyPrefab)
                {
                    Debug.LogError("Failed to add variant: " + info.bodyName + "Body does not exist.");
                    return;
                }

                bodyPrefab.AddComponent <Components.VariantHandler>().Init(info);
            };
        }
예제 #4
0
 // helper to simplify adding a variant
 public static void AddVariant(MonsterVariantInfo info)
 {
     AddVariant(Resources.Load <GameObject>("Prefabs/CharacterBodies/" + info.bodyName + "Body"), info);
 }
예제 #5
0
 // helper to simplify adding a variant
 internal static void AddVariant(MonsterVariantInfo info)
 {
     Components.VariantHandler variantHandler = Resources.Load <GameObject>("Prefabs/CharacterBodies/" + info.bodyName + "Body").AddComponent <Components.VariantHandler>();
     variantHandler.Init(info);
 }