Beispiel #1
0
 public void Awake()
 {
     #region survivor
     SurvivorAPI.SurvivorCatalogReady += delegate(object s, EventArgs e)
     {
         {
             var         bandit = BodyCatalog.FindBodyPrefab("BanditBody");
             SurvivorDef item   = new SurvivorDef
             {
                 bodyPrefab       = bandit,
                 descriptionToken = "test",
                 displayPrefab    = Resources.Load <GameObject>("prefabs/characterbodies/banditbody").GetComponent <ModelLocator>().modelTransform.gameObject,
                 primaryColor     = new Color(0.87890625f, 0.662745098f, 0.3725490196f),
                 unlockableName   = "",
                 survivorIndex    = SurvivorIndex.Count
             };
             #region skills
             #if skills
             Primary.SetPrimary(bandit);
             PrepSecondary.SetSecondary(bandit);
             Banditspecial(bandit);
             EntityStates.Bandit.Utility.SetUtility(bandit);
             #endif
             #endregion skills
             SkillManagement.banditskilldescriptions(bandit);
             SurvivorAPI.AddSurvivor(item);
         }
     };
     #endregion
     #region timer
     #if timer
     Timer.Init();
     #endif
     #endregion
 }
Beispiel #2
0
        private void RegisterSephiroth()
        {
            // gather our prefabs
            var sephPrefab        = Resources.Load <GameObject>("prefabs/characterbodies/commandobody").InstantiateClone("SephBody");
            var commandoPrefab    = Resources.Load <GameObject>("prefabs/characterbodies/commandobody");
            var sephDisplayPrefab = Resources.Load <GameObject>("prefabs/characterdisplays/commandodisplay").InstantiateClone("SephDisplay", false);

            // swap the models
            RegisterModelSwap(sephPrefab, sephDisplayPrefab);

            // Register sephs Skills
            RegisterSkills(sephPrefab);

            // register in body catalog
            var sephBody = sephPrefab.GetComponentInChildren <CharacterBody>();

            BodyCatalog.getAdditionalEntries += (list) => list.Add(sephPrefab);
            sephBody.baseNameToken            = "Sephiroth";

            // Register sephs stats
            RegisterStats(sephBody);

            // character needs pod?
            if (sephBody.preferredPodPrefab == null)
            {
                sephBody.preferredPodPrefab = commandoPrefab.GetComponentInChildren <CharacterBody>().preferredPodPrefab;
            }

            // register sephs genericcharactermain
            var stateMachine = sephBody.GetComponent <EntityStateMachine>();

            stateMachine.mainStateType = new EntityStates.SerializableEntityStateType(typeof(EntityStates.Sephiroth.Sephiroth));

            // register icon
            sephBody.portraitIcon = Assets.SephIcon.texture;

            // register survivor info
            SurvivorDef item = new SurvivorDef
            {
                name             = "SEPHIROTH_BODY",
                bodyPrefab       = sephPrefab,
                descriptionToken = "Kingdom Hearts, is light...",
                displayPrefab    = sephDisplayPrefab,
                primaryColor     = new Color(0.0f, 0.0f, 0.0f),
                unlockableName   = "Sephiroth",
                survivorIndex    = SurvivorIndex.Count + 1
            };

            SurvivorAPI.AddSurvivor(item);
            On.RoR2.BodyCatalog.Init += orig =>
            {
                orig();
                var bodyIndex = BodyCatalog.FindBodyIndex("SephBody");
                BodyCatalog.GetBodyPrefab(bodyIndex).GetComponent <CharacterBody>().baseNameToken = "Sephiroth";
            };
        }
Beispiel #3
0
        public void Awake()
        {
            myCharacter = Resources.Load <GameObject>("Prefabs/CharacterBodies/BrotherBody").InstantiateClone("BrotherPlayerBody");
            GameObject gameObject = myCharacter.GetComponent <ModelLocator>().modelBaseTransform.gameObject;

            gameObject.transform.localScale *= 0.45f;
            gameObject.transform.Translate(new Vector3(0, 3, 0));
            myCharacter.GetComponent <CharacterBody>().aimOriginTransform.Translate(new Vector3(0, -3, 0));

            BodyCatalog.getAdditionalEntries += delegate(List <GameObject> list)
            {
                list.Add(myCharacter);
            };

            gameObject.AddComponent <Animation>();

            CharacterBody component = myCharacter.GetComponent <CharacterBody>();

            component.baseJumpPower  = Resources.Load <GameObject>("Prefabs/CharacterBodies/LoaderBody").GetComponent <CharacterBody>().baseJumpPower;
            component.baseMoveSpeed  = Resources.Load <GameObject>("Prefabs/CharacterBodies/LoaderBody").GetComponent <CharacterBody>().baseMoveSpeed;
            component.levelMoveSpeed = Resources.Load <GameObject>("Prefabs/CharacterBodies/LoaderBody").GetComponent <CharacterBody>().levelMoveSpeed;
            component.baseDamage     = 18f;
            component.levelDamage    = 0.6f;
            component.baseCrit       = 2f;
            component.levelCrit      = 1f;
            component.baseMaxHealth  = 300f;
            component.levelMaxHealth = 25f;
            component.baseArmor      = 20f;
            component.baseRegen      = 1f;
            component.levelRegen     = 0.4f;
            component.baseMoveSpeed  = 8f;
            //component.levelMoveSpeed = 0.25f;
            component.baseAttackSpeed = 5f;
            component.name            = "PlayableMithrixBody";

            myCharacter.tag = "Player";

            myCharacter.AddComponent <ItemDisplay>();
            myCharacter.GetComponent <CharacterBody>().preferredPodPrefab = Resources.Load <GameObject>("Prefabs/CharacterBodies/toolbotbody").GetComponent <CharacterBody>().preferredPodPrefab;

            SurvivorDef survivorDef = new SurvivorDef
            {
                bodyPrefab       = myCharacter,
                descriptionToken = "MyDescription",
                displayPrefab    = gameObject,
                primaryColor     = new Color(0.8039216f, 0.482352942f, 0.843137264f),
                name             = "ScavPlayerBody",
                unlockableName   = ""// "Logs.Stages.limbo"
            };

            SurvivorAPI.AddSurvivor(survivorDef);
        }
        public void Awake()
        {
            var banditDisplay = Resources.Load <GameObject>("prefabs/characterbodies/banditbody").GetComponent <ModelLocator>().modelTransform.gameObject;

            banditDisplay.AddComponent <MenuAnimComponent>();
            SurvivorDef item = new SurvivorDef
            {
                bodyPrefab       = Resources.Load <GameObject>("prefabs/characterbodies/banditbody"),
                descriptionToken = "The Bandit is a hit-and-run survivor who excels at assassinating single targets.<color=#CCD3E0>\n\n< ! > Blast fires faster if you click faster!\n\n< ! > Dealing a killing blow with Lights Out allows you to chain many skills together, allowing for maximum damage AND safety.\n\n< ! > Use Smokebomb to either run away or to stun many enemies at once.\n\n< ! > Grenade Toss can trigger item effects.</color>",
                displayPrefab    = banditDisplay,
                primaryColor     = new Color(0.8039216f, 0.482352942f, 0.843137264f),
                unlockableName   = ""
            };

            SurvivorAPI.AddSurvivor(item);

            On.RoR2.HealthComponent.TakeDamage += (orig, self, damageInfo) =>
            {
                orig(self, damageInfo);
                if (damageInfo.inflictor != null && (damageInfo.inflictor.name == "BanditBody(Clone)") &&
                    (damageInfo.damageType == (DamageType.ResetCooldownsOnKill | DamageType.BypassArmor) || damageInfo.damageType == DamageType.ResetCooldownsOnKill))
                {
                    if (self.alive)
                    {
                        if (LightsOutExecute.Value)
                        {
                            float executeThreshold = LightsOutExecutePercentageBase.Value;
                            if (self.body.isElite)
                            {
                                executeThreshold += damageInfo.inflictor.GetComponent <CharacterBody>().executeEliteHealthFraction;
                            }
                            if (self.isInFrozenState && executeThreshold < (0.3f + LightsOutExecutePercentageBase.Value))
                            {
                                executeThreshold = 0.3f + LightsOutExecutePercentageBase.Value;
                            }

                            if (self.alive && (self.combinedHealthFraction < executeThreshold))
                            {
                                damageInfo.damage          = self.health;
                                damageInfo.damageType      = (DamageType.ResetCooldownsOnKill | DamageType.BypassArmor);
                                damageInfo.procCoefficient = 0f;
                                damageInfo.crit            = true;
                                orig(self, damageInfo);
                            }
                        }
                    }
                }
            };
            base.StartCoroutine(this.FixIce());
        }
Beispiel #5
0
        private static void RegisterSurvivor()
        {
            SurvivorDef survivorDef = new SurvivorDef
            {
                name             = "SONGSTRESS_NAME",
                descriptionToken = "SONGSTRESS_DESC",
                bodyPrefab       = bodyPrefab,
                displayPrefab    = displayPrefab,
                primaryColor     = ColorMaster.ZeroColor,
                unlockableName   = ""
            };

            SurvivorAPI.AddSurvivor(survivorDef);
        }
        void RegisterCharacter()
        {
            myCharacterDisplay = PrefabAPI.InstantiateClone(characterPrefab.GetComponent <ModelLocator>().modelBaseTransform.gameObject, "ExecutionerDisplay", true);
            myCharacterDisplay.AddComponent <NetworkIdentity>();

            BodyCatalog.getAdditionalEntries += delegate(List <GameObject> list)
            {
                list.Add(characterPrefab);
            };

            CharacterBody component = characterPrefab.GetComponent <CharacterBody>();

            component.baseDamage      = 10f;
            component.baseCrit        = 1f;
            component.levelCrit       = 0f;
            component.baseMaxHealth   = 400f;
            component.levelMaxHealth  = 40f;
            component.baseArmor       = 20f;
            component.baseRegen       = 2f;
            component.levelRegen      = 0.2f;
            component.baseMoveSpeed   = 8f;
            component.levelMoveSpeed  = 0.25f;
            component.baseAttackSpeed = 1f;
            component.name            = "Executioner";

            characterPrefab.GetComponent <CharacterBody>().preferredPodPrefab = Resources.Load <GameObject>("Prefabs/CharacterBodies/toolbotbody").GetComponent <CharacterBody>().preferredPodPrefab;
            LanguageAPI.Add("EXECUTIONER_DESCRIPTION"
                            , @"The Executioner is a high risk high reward survivor that's all about racking up an endless kill count.

< ! > Use Service Pistol to score some kills, and use those to charge up Ion Burst for massive damage.

< ! > Saving up Ion Burst charges is a risky move, but can pay off if you can get a bunch of shots off on a boss.

< ! > If you find yourself getting swarmed, Crowd Dispersion can get enemies off your back fast.

< ! > Execution is a great crowd control AND single target tool, don't forget its damage depends on how many targets it hits!");

            var mySurvivorDef = new SurvivorDef
            {
                bodyPrefab       = characterPrefab,
                descriptionToken = "EXECUTIONER_DESCRIPTION",
                displayPrefab    = myCharacterDisplay,
                primaryColor     = new Color(0.8039216f, 0.482352942f, 0.843137264f),
                name             = "Executioner",
                unlockableName   = "",
            };

            SurvivorAPI.AddSurvivor(mySurvivorDef);
        }
Beispiel #7
0
        internal static void RegisterNewSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string namePrefix, string unlockString)
        {
            SurvivorDef survivorDef = new SurvivorDef
            {
                name             = HenryPlugin.developerPrefix + "_" + namePrefix + "_BODY_NAME",
                unlockableName   = unlockString,
                descriptionToken = HenryPlugin.developerPrefix + "_" + namePrefix + "_BODY_DESCRIPTION",
                primaryColor     = charColor,
                bodyPrefab       = bodyPrefab,
                displayPrefab    = displayPrefab,
                outroFlavorToken = HenryPlugin.developerPrefix + "_" + namePrefix + "_BODY_OUTRO_FLAVOR",
            };

            SurvivorAPI.AddSurvivor(survivorDef);
        }
Beispiel #8
0
        public static void RegisterSurvivors()
        {
            //Prefabs.haleDisplayPrefab.AddComponent<NetworkIdentity>();

            SurvivorDef survivorDef = new SurvivorDef
            {
                name             = "SAXTONHALE_NAME",
                descriptionToken = "SAXTONHALE_DESCRIPTION",
                primaryColor     = SaxtonHalePlugin.characterColor,
                bodyPrefab       = Prefabs.halePrefab,
                //displayPrefab = Prefabs.haleDisplayPrefab,
                outroFlavorToken = "SAXTONHALE_OUTRO_FLAVOR"
            };

            SurvivorAPI.AddSurvivor(survivorDef);
        }
Beispiel #9
0
        private void RegisterPyroSurvivor()
        {
            GameObject  tempDisplay = PyroObject.GetComponent <ModelLocator>().modelTransform.gameObject;
            SurvivorDef item        = new SurvivorDef
            {
                name             = "Pyro",
                bodyPrefab       = PyroObject,
                descriptionToken = "PYRO_DESCRPTION",
                displayPrefab    = tempDisplay,
                primaryColor     = PyroColor,
                unlockableName   = "",
                outroFlavorToken = "PYRO_OUTRO_FLAVOR"
            };

            SurvivorAPI.AddSurvivor(item);
        }
 public void Awake() => SurvivorAPI.SurvivorCatalogReady += delegate(object s, EventArgs e)
 {
     {
         var         Bomber = BodyCatalog.FindBodyPrefab("BomberBody");
         SurvivorDef item   = new SurvivorDef
         {
             bodyPrefab       = Bomber,
             descriptionToken = "Shotgun",
             displayPrefab    = Bomber.GetComponent <ModelLocator>().modelTransform.gameObject,
             primaryColor     = new Color(42.947f, 19.846f, 4.338f),
             unlockableName   = "",
             survivorIndex    = SurvivorIndex.Count
         };
         SurvivorAPI.AddSurvivor(item);
     }
 };
Beispiel #11
0
        public static void Initialize()
        {
            display = PrefabAPI.InstantiateClone(body.GetComponent <ModelLocator>().modelBaseTransform.gameObject, "UrsaDisplay", true);
            display.AddComponent <NetworkIdentity>();

            SurvivorDef survivorDef = ScriptableObject.CreateInstance <SurvivorDef>();

            survivorDef.cachedName       = "URSA_NAME";
            survivorDef.descriptionToken = "URSA_DESCRIPTION";
            survivorDef.outroFlavorToken = "URSA_OUTRO_FLAVOR";
            survivorDef.primaryColor     = Color.magenta;
            survivorDef.bodyPrefab       = body;
            survivorDef.displayPrefab    = display;

            SurvivorAPI.AddSurvivor(survivorDef);
            UrsaPlugin.characterMasters.Add(doppelgangerMaster);
        }
        public void Create <T>(CharacterInformation info, GameObject bodyPrefab, GameObject displayPrefab)
        {
            UnityEngine.Debug.Log("3");

            //Register Skills
            new SkillRegister(bodyPrefab.GetComponentInChildren <SkillLocator>()).RegisterSkills();
            UnityEngine.Debug.Log("4");

            // Register Body Catalog
            var body = bodyPrefab.GetComponentInChildren <CharacterBody>();

            BodyCatalog.getAdditionalEntries += (list) => list.Add(bodyPrefab);

            // Register GenericMainCharacter
            var stateMachine = body.GetComponent <EntityStateMachine>();

            stateMachine.mainStateType = new EntityStates.SerializableEntityStateType(typeof(T));

            // register icon
            //body.portraitIcon = Assets

            if (info.CustomStats != null)
            {
                // Register custom stats
            }

            // Set preferred pod?
            if (body.preferredPodPrefab == null)
            {
                body.preferredPodPrefab = Resources.Load <GameObject>("prefabs/characterbodies/commandobody").GetComponentInChildren <CharacterBody>().preferredPodPrefab;
            }

            // register surv def
            var survDef = new SurvivorDef
            {
                bodyPrefab       = bodyPrefab,
                displayPrefab    = displayPrefab,
                name             = info.Name,
                descriptionToken = info.Description,
                primaryColor     = new Color(1, 1, 1),
                unlockableName   = ""
            };

            SurvivorAPI.AddSurvivor(survDef);
        }
        public static void Initialize()
        {
            stanWorshipperDisplay = PrefabAPI.InstantiateClone(stanWorshipperBody.GetComponent <ModelLocator>().modelBaseTransform.gameObject, "StanWorshipperDisplay", true);
            stanWorshipperDisplay.AddComponent <NetworkIdentity>();

            var stanWorshipper = ScriptableObject.CreateInstance <SurvivorDef>();

            stanWorshipper.bodyPrefab       = stanWorshipperBody;
            stanWorshipper.cachedName       = "STANWORSHIPPER_NAME";
            stanWorshipper.displayNameToken = "STANWORSHIPPER_NAME";
            stanWorshipper.descriptionToken = "STANWORSHIPPER_DESCRIPTION";
            stanWorshipper.outroFlavorToken = "STANWORSHIPPER_OUTRO_FLAVOR";
            stanWorshipper.displayPrefab    = stanWorshipperDisplay;
            stanWorshipper.primaryColor     = new Color(0.6f, 0.3f, 0f);

            SurvivorAPI.AddSurvivor(stanWorshipper);
            StanWorshipperPlugin.characterMasters.Add(stanWorshipperDoppelganger);
        }
Beispiel #14
0
 public void Awake()
 {
     SurvivorAPI.SurvivorCatalogReady += delegate(object s, EventArgs e)
     {
         foreach (var survivor in BodyCatalog.allBodyPrefabs)
         {
             SurvivorDef surdef = new SurvivorDef
             {
                 bodyPrefab       = survivor,
                 displayPrefab    = survivor?.GetComponent <ModelLocator>()?.modelTransform?.gameObject,
                 descriptionToken = survivor.name,
                 primaryColor     = new Color(0.87890625f, 0.662745098f, 0.3725490196f),
                 unlockableName   = "",
                 survivorIndex    = SurvivorIndex.Count
             };
             SurvivorAPI.AddSurvivor(surdef);
         }
     };
 }
 public void Awake()
 {
     SurvivorAPI.SurvivorCatalogReady += delegate(object s, EventArgs e)
     {
         {
             var         sniper = BodyCatalog.FindBodyPrefab("SniperBody");
             SurvivorDef item   = new SurvivorDef
             {
                 bodyPrefab       = sniper,
                 descriptionToken = "Sniper",
                 displayPrefab    = sniper,//.GetComponent<ModelLocator>().modelTransform.gameObject,
                 primaryColor     = new Color(0.87890625f, 0.662745098f, 0.3725490196f),
                 unlockableName   = "",
                 survivorIndex    = (SurvivorIndex)int.MaxValue
             };
             SurvivorAPI.AddSurvivor(item);
         }
     };
 }
 public void Awake()
 {
     SurvivorAPI.SurvivorCatalogReady += delegate(object s, EventArgs e)
     {
         {
             var         HAND = BodyCatalog.FindBodyPrefab("HANDBody");
             SurvivorDef item = new SurvivorDef
             {
                 bodyPrefab       = HAND,
                 descriptionToken = "HAND",
                 displayPrefab    = Resources.Load <GameObject>("Prefabs/Characters/HANDDisplay"),
                 primaryColor     = new Color(0.87890625f, 0.662745098f, 0.3725490196f),
                 unlockableName   = "",
                 survivorIndex    = SurvivorIndex.Count
             };
             SurvivorAPI.AddSurvivor(item);
         }
     };
 }
Beispiel #17
0
        private void AW_Register()
        {
            BodyCatalog.getAdditionalEntries   += (list) => list.Add(this.AW_body);
            MasterCatalog.getAdditionalEntries += (list) => list.Add(this.AW_master);

#if ANCIENTWISPSURVMENU
            var def = new SurvivorDef
            {
                bodyPrefab       = this.AW_body,
                descriptionToken = "AAA",
                displayPrefab    = this.AW_body.GetComponent <ModelLocator>().modelBaseTransform.gameObject,
                primaryColor     = Color.white,
                unlockableName   = ""
            };
            SurvivorAPI.AddSurvivor(def);

            this.AW_body.GetComponent <CharacterBody>().preferredInitialStateType = this.AW_body.GetComponent <EntityStateMachine>().initialStateType;
#endif
        }
        public static void RegisterSurvivors()
        {
            //Prefabs.paladinDisplayPrefab.AddComponent<NetworkIdentity>(); TODO

            string unlockString = "SCOUT_UNLOCKABLE_REWARD_ID";
            //if (Config.forceUnlock.Value) unlockString = "";

            SurvivorDef survivorDef = new SurvivorDef //TODO CrossRef with document
            {
                name             = "SCOUT_NAME",
                unlockableName   = unlockString,
                descriptionToken = "SCOUT_DESCRIPTION",
                primaryColor     = ScoutPlugin.characterColor,
                bodyPrefab       = ScoutPlugin.characterPrefab,
                //displayPrefab = characterDisplay,
                outroFlavorToken = "SCOUT_OUTRO_FLAVOR"
            };

            SurvivorAPI.AddSurvivor(survivorDef);
        }
Beispiel #19
0
        private void RegisterCharacter()
        {
            // now that the body prefab's set up, clone it here to make the display prefab
            characterDisplay = PrefabAPI.InstantiateClone(characterPrefab.GetComponent <ModelLocator>().modelBaseTransform.gameObject, "ExampleSurvivorDisplay", true, "C:\\Users\\test\\Documents\\ror2mods\\ExampleSurvivor\\ExampleSurvivor\\ExampleSurvivor\\ExampleSurvivor.cs", "RegisterCharacter", 153);
            characterDisplay.AddComponent <NetworkIdentity>();

            // write a clean survivor description here!
            string desc = "Wisp is a supportive survivor who can rejuvenate their allies, or sap the strength of their enemies <color=#CCD3E0>" + Environment.NewLine + Environment.NewLine;

            desc = desc + "< ! > Your tether will pull you to your target when cast - use it to escape from danger" + Environment.NewLine + Environment.NewLine;
            desc = desc + "< ! > Burst deals damage around both you and your partner. Enemies close enough to be affected by both will take double damage" + Environment.NewLine + Environment.NewLine;
            desc = desc + "< ! > Siphon deals non-lethal damage - you'll need to use other skills or items to finish enemies off" + Environment.NewLine + Environment.NewLine;
            desc = desc + "< ! > Tethering to an ally will increase their regen rate based on your own regen rate at the time of the tether.</color>" + Environment.NewLine + Environment.NewLine;

            // add the language tokens
            LanguageAPI.Add("WISP_NAME", "Wisp");
            LanguageAPI.Add("WISP_DESCRIPTION", desc);
            LanguageAPI.Add("WISP_SUBTITLE", "The Phantasm");

            // add our new survivor to the game~
            SurvivorDef survivorDef = new SurvivorDef
            {
                name             = "WISP_NAME",
                unlockableName   = "",
                descriptionToken = "WISP_DESCRIPTION",
                primaryColor     = characterColor,
                bodyPrefab       = characterPrefab,
                displayPrefab    = characterDisplay
            };

            // set up the survivor's skills here
            SkillSetup();

            SurvivorAPI.AddSurvivor(survivorDef);

            // gotta add it to the body catalog too
            BodyCatalog.getAdditionalEntries += delegate(List <GameObject> list)
            {
                list.Add(characterPrefab);
            };
        }
Beispiel #20
0
        private void CreateSurvivorDef()
        {
            string desc = "AYO HOL' UP <color=#CCD3E0>" + Environment.NewLine + Environment.NewLine;

            LanguageAPI.Add("HENRY_DESCRIPTION", desc);
            LanguageAPI.Add("HENRY_OUTRO_FLAVOR", "...and so he left, awesome coursing through his veins");

            SurvivorDef def = new SurvivorDef()
            {
                bodyPrefab       = this.HenryBody,
                descriptionToken = "HENRY_DESCRIPTION",
                displayNameToken = "HENRY_BODY_NAME",
                displayPrefab    = Assets.mainAssetBundle.LoadAsset <GameObject>("HenryDisplay"),
                name             = "Henry",
                outroFlavorToken = "HENRY_OUTRO_FLAVOR",
                primaryColor     = Color.black,
                unlockableName   = "",
            };

            SurvivorAPI.AddSurvivor(def);
        }
Beispiel #21
0
        public static void RegisterSurvivors()
        {
            Prefabs.paladinDisplayPrefab.AddComponent <NetworkIdentity>();

            string unlockString = "PALADIN_UNLOCKABLE_REWARD_ID";

            if (Config.forceUnlock.Value)
            {
                unlockString = "";
            }

            SurvivorDef survivorDef = new SurvivorDef
            {
                name             = "PALADIN_NAME",
                unlockableName   = unlockString,
                descriptionToken = "PALADIN_DESCRIPTION",
                primaryColor     = PaladinPlugin.characterColor,
                bodyPrefab       = Prefabs.paladinPrefab,
                displayPrefab    = Prefabs.paladinDisplayPrefab,
                outroFlavorToken = "PALADIN_OUTRO_FLAVOR"
            };

            SurvivorAPI.AddSurvivor(survivorDef);


            /*SurvivorDef tempDef = new SurvivorDef
             * {
             *  name = "LUNAR_KNIGHT_BODY_NAME",
             *  unlockableName = "",
             *  descriptionToken = "LUNAR_KNIGHT_BODY_DESCRIPTION",
             *  primaryColor = PaladinPlugin.characterColor,
             *  bodyPrefab = Prefabs.lunarKnightPrefab,
             *  displayPrefab = Prefabs.paladinDisplayPrefab,
             *  outroFlavorToken = "LUNAR_KNIGHT_BODY_OUTRO_FLAVOR"
             * };
             *
             * SurvivorAPI.AddSurvivor(tempDef);*/
        }
Beispiel #22
0
        private void Awake()
        {
            using (var assetStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("SkinTest.skintest"))
            {
                var MainAssetBundle = AssetBundle.LoadFromStream(assetStream);
                ResourcesAPI.AddProvider(new AssetBundleResourcesProvider("@SkinTest", MainAssetBundle));
            }

            var commandoPrefab = Resources.Load <GameObject>("prefabs/characterbodies/CommandoBody").InstantiateClone("CommandoCopy");
            var commandoBody   = commandoPrefab.GetComponent <CharacterBody>();

            commandoBody.baseNameToken = "test";

            Debug.Log(string.Join(", ", commandoPrefab.GetComponentInChildren <SkinnedMeshRenderer>().bones.Select(el => "'" + el.name + "'")));
            BodyCatalog.getAdditionalEntries += (list) => list.Add(commandoPrefab);

            var mySurvivorDef = new SurvivorDef
            {
                name             = "Test commando" + Environment.NewLine,
                bodyPrefab       = commandoPrefab,
                descriptionToken = "Test commando",
                displayPrefab    = Resources.Load <GameObject>("prefabs/characterdisplays/CommandoDisplay").InstantiateClone("CommandoTestDisplay", false),
                primaryColor     = new Color(0.8039216f, 0.482352942f, 0.843137264f),
                unlockableName   = "",
            };

            SurvivorAPI.AddSurvivor(mySurvivorDef);

            var skinController = commandoPrefab.GetComponentInChildren <ModelSkinController>();
            var mdl            = skinController.gameObject;
            var renderer       = mdl.GetComponentInChildren <SkinnedMeshRenderer>();
            var renderers      = mdl.transform.GetChild(0).GetComponentsInChildren <Renderer>();

            var altSkin = new LoadoutAPI.SkinDefInfo();

            altSkin.Name           = "ComandoCustomAlt";
            altSkin.NameToken      = "TEST_SKIN";
            altSkin.RootObject     = mdl;
            altSkin.BaseSkins      = new SkinDef[0];// { skinController.skins[0] };
            altSkin.UnlockableName = "";
            altSkin.RendererInfos  = new CharacterModel.RendererInfo[]
            {
                new CharacterModel.RendererInfo()
                {
                    defaultMaterial          = Resources.Load <Material>("@SkinTest:Assets/Resources/matMercAlt.mat"),
                    defaultShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On,
                    ignoreOverlays           = false,
                    renderer = renderer
                },
                new CharacterModel.RendererInfo()
                {
                    defaultMaterial          = Resources.Load <Material>("@SkinTest:Assets/Resources/matMercAlt.mat"),
                    defaultShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On,
                    ignoreOverlays           = false,
                    renderer = renderers[0]
                },
                new CharacterModel.RendererInfo()
                {
                    defaultMaterial          = Resources.Load <Material>("@SkinTest:Assets/Resources/matMercAlt.mat"),
                    defaultShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On,
                    ignoreOverlays           = false,
                    renderer = renderers[1]
                }
            };
            altSkin.GameObjectActivations = new SkinDef.GameObjectActivation[0];
            //altSkin.MinionSkinReplacements = new SkinDef.MinionSkinReplacement[0];
            //altSkin.ProjectileGhostReplacements = new SkinDef.ProjectileGhostReplacement[0];
            altSkin.MeshReplacements = new SkinDef.MeshReplacement[]
            {
                new SkinDef.MeshReplacement()
                {
                    mesh     = Resources.Load <Mesh>("@SkinTest:Assets/Resources/skintest.blend"),
                    renderer = renderer
                }
            };

            Array.Resize(ref skinController.skins, skinController.skins.Length + 1);
            skinController.skins[skinController.skins.Length - 1] = LoadoutAPI.CreateNewSkinDef(altSkin);
        }
Beispiel #23
0
        public void Awake()
        {
            // myCharacter should either be
            // Resources.Load<GameObject>("prefabs/characterbodies/BanditBody");
            // or BodyCatalog.FindBodyIndex("BanditBody");
            var myCharacter = Resources.Load <GameObject>("prefabs/characterbodies/CommandoBody");

            // If you're confused about the language tokens, they're the proper way to add any strings used by the game.
            // We use AssetPlus API for that
            LanguageAPI.Add("MYBANDIT_DESCRIPTION", "cum! cum! f**k!" + Environment.NewLine);

            var mySurvivorDef = new SurvivorDef
            {
                //We're finding the body prefab here,
                bodyPrefab = myCharacter,
                //Description
                descriptionToken = "MYBANDIT_DESCRIPTION",
                //Display
                displayPrefab = Resources.Load <GameObject>("Prefabs/Characters/BanditDisplay"),
                //Color on select screen
                primaryColor = new Color(0.8039216f, 0.482352942f, 0.843137264f),
                //Unlockable name
                unlockableName = "",
            };

            SurvivorAPI.AddSurvivor(mySurvivorDef);

            // If you're confused about the language tokens, they're the proper way to add any strings used by the game.
            // We use AssetPlus API for that
            LanguageAPI.Add("COMMANDO_PRIMARY_BURSTFIRE_NAME", "Burst Fire");
            LanguageAPI.Add("COMMANDO_PRIMARY_BURSTFIRE_DESCRIPTION", "Unload a burst of 3 bullets for 3x100% damage");

            var mySkillDef = ScriptableObject.CreateInstance <SkillDef>();

            mySkillDef.activationState            = new SerializableEntityStateType(typeof(MyNameSpace.MyEntityStates.Commando_Primary));
            mySkillDef.activationStateMachineName = "Weapon";
            mySkillDef.baseMaxStock                 = 1;
            mySkillDef.baseRechargeInterval         = 0f;
            mySkillDef.beginSkillCooldownOnSkillEnd = true;
            mySkillDef.canceledFromSprinting        = true;
            mySkillDef.fullRestockOnAssign          = true;
            mySkillDef.interruptPriority            = InterruptPriority.Any;
            mySkillDef.isBullets      = true;
            mySkillDef.isCombatSkill  = false;
            mySkillDef.mustKeyPress   = false;
            mySkillDef.noSprint       = true;
            mySkillDef.rechargeStock  = 1;
            mySkillDef.requiredStock  = 1;
            mySkillDef.shootDelay     = 0.5f;
            mySkillDef.stockToConsume = 1;
            //mySkillDef.icon = Resources.Load<Sprite>("NotAnActualPath");
            mySkillDef.skillDescriptionToken = "COMMANDO_PRIMARY_BURSTFIRE_DESCRIPTION";
            mySkillDef.skillName             = "COMMANDO_PRIMARY_BURSTFIRE_NAME";
            mySkillDef.skillNameToken        = "COMMANDO_PRIMARY_BURSTFIRE_NAME";

            LanguageAPI.Add("COMMANDO_SECONDARY_BACKUPSHIV_NAME", "Backup Shiv");
            LanguageAPI.Add("COMMANDO_SECONDARY_BACKUPSHIV_DESCRIPTION", "Slice for 220% damage. Recover 7% health on kill.");

            var commandoSecondarySkillDef = ScriptableObject.CreateInstance <SkillDef>();

            commandoSecondarySkillDef.activationState            = new SerializableEntityStateType(typeof(MyNameSpace.MyEntityStates.Commando_Secondary));
            commandoSecondarySkillDef.activationStateMachineName = "Weapon";
            commandoSecondarySkillDef.baseMaxStock                 = 1;
            commandoSecondarySkillDef.baseRechargeInterval         = 2f;
            commandoSecondarySkillDef.beginSkillCooldownOnSkillEnd = true;
            commandoSecondarySkillDef.canceledFromSprinting        = false;
            commandoSecondarySkillDef.fullRestockOnAssign          = false;
            commandoSecondarySkillDef.interruptPriority            = InterruptPriority.Any;
            commandoSecondarySkillDef.isBullets     = false;
            commandoSecondarySkillDef.isCombatSkill = true;
            commandoSecondarySkillDef.mustKeyPress  = false;
            commandoSecondarySkillDef.noSprint      = false;
            commandoSecondarySkillDef.rechargeStock = 1;
            commandoSecondarySkillDef.requiredStock = 1;
            //commandoSecondarySkillDef.shootDelay = 0.5f;
            commandoSecondarySkillDef.stockToConsume        = 1;
            commandoSecondarySkillDef.skillDescriptionToken = "COMMANDO_SECONDARY_BACKUPSHIV_DESCRIPTION";
            commandoSecondarySkillDef.skillName             = "COMMANDO_SECONDARY_BACKUPSHIV_NAME";
            commandoSecondarySkillDef.skillNameToken        = "COMMANDO_SECONDARY_BACKUPSHIV_NAME";

            LoadoutAPI.AddSkillDef(mySkillDef);
            LoadoutAPI.AddSkillDef(commandoSecondarySkillDef);
            //This adds our skilldef. If you don't do this, the skill will not work.

            var skillLocator = myCharacter.GetComponent <SkillLocator>();

            //Note; you can change component.primary to component.secondary , component.utility and component.special
            var skillFamily  = skillLocator.primary.skillFamily;
            var skillFamily2 = skillLocator.secondary.skillFamily;

            //var skillFamily3 = skillLocator.utility.skillFamily;

            Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
            skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant
            {
                skillDef       = mySkillDef,
                unlockableName = "",
                viewableNode   = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null)
            };
            Array.Resize(ref skillFamily2.variants, skillFamily2.variants.Length + 1);
            skillFamily2.variants[skillFamily2.variants.Length - 1] = new SkillFamily.Variant
            {
                skillDef       = commandoSecondarySkillDef,
                unlockableName = "",
                viewableNode   = new ViewablesCatalog.Node(commandoSecondarySkillDef.skillNameToken, false, null)
            };/*
               * Array.Resize(ref skillFamily3.variants, skillFamily3.variants.Length + 1);
               * skillFamily.variants[skillFamily3.variants.Length - 1] = new SkillFamily.Variant
               * {
               * skillDef = commandoSecondarySkillDef,
               * unlockableName = "",
               * viewableNode = new ViewablesCatalog.Node(commandoSecondarySkillDef.skillNameToken, false, null)
               * };*/
        }
Beispiel #24
0
        public void Awake()
        {
            //SkillModifierManager.LoadSkillModifiers();

            //Until I figure out how to make an assetbundle for the characters. #HELP
            var myChar = Resources.Load <GameObject>("prefabs/characterbodies/CommandoBody");

            Languages.AddToken("DVA_DESCRIPTION", "짜증나!" + Environment.NewLine);

            var mySurvivorDef = new SurvivorDef
            {
                bodyPrefab       = myChar,
                descriptionToken = "DVA_DESCRIPTION",
                displayPrefab    = Resources.Load <GameObject>("Prefabs/Characters/CommandoDisplay"),
                primaryColor     = new Color(0.98046875f, 0.12890625f, 0.9765625f),
                unlockableName   = "",
            };

            SurvivorAPI.AddSurvivor(mySurvivorDef);

            //TOKKI PRIMARY: FUSION CANNONS
            #region
            Languages.AddToken("TOKKI_PRIMARY_FUSIONCANNONS_NAME", "Fusion Cannons");
            Languages.AddToken("TOKKI_PRIMARY_FUSIONCANNONS_DESCRIPTION", "D.Va's mech is equipped with twin short-range rotating cannons. They lay down continuous, high-damage fire without needing to reload, but slow D.Va’s movement while they’re active.");

            var mySkillDef = ScriptableObject.CreateInstance <SkillDef>();
            mySkillDef.activationState            = new SerializableEntityStateType(typeof(GoofballGames.TokkiEntityStates.Tokki_FusionCannons));
            mySkillDef.activationStateMachineName = "Weapon";
            mySkillDef.baseMaxStock                 = 0;
            mySkillDef.baseRechargeInterval         = 0f;
            mySkillDef.beginSkillCooldownOnSkillEnd = true;
            mySkillDef.canceledFromSprinting        = true;
            mySkillDef.fullRestockOnAssign          = true;
            mySkillDef.interruptPriority            = InterruptPriority.Frozen;
            mySkillDef.isBullets      = true;
            mySkillDef.isCombatSkill  = true;
            mySkillDef.mustKeyPress   = false;
            mySkillDef.noSprint       = true;
            mySkillDef.rechargeStock  = 0;
            mySkillDef.requiredStock  = 0;
            mySkillDef.shootDelay     = 0.15f;
            mySkillDef.stockToConsume = 0;
            //mySkillDef.icon = Resources.Load<Sprite>("");  Gotta figure out bundles, I think... #HELP
            mySkillDef.skillDescriptionToken = "TOKKI_PRIMARY_FUSIONCANNONS_DESCRIPTION";
            mySkillDef.skillName             = "TOKKI_PRIMARY_FUSIONCANNONS_NAME";
            mySkillDef.skillNameToken        = "TOKKI_PRIMARY_FUSIONCANNONS_NAME";

            var skillLocator = myChar.GetComponent <SkillLocator>();

            //Note; if your character does not originally have a skill family for this, use the following:
            //skillLocator.special = gameObject.AddComponent<GenericSkill>();
            //var newFamily = ScriptableObject.CreateInstance<SkillFamily>();
            //LoadoutAPI.AddSkillFamily(newFamily);
            //skillLocator.special.SetFieldValue("_skillFamily", newFamily);
            //var specialSkillFamily = skillLocator.special.skillFamily;


            //Note; you can change component.primary to component.secondary , component.utility and component.special
            var skillFamily = skillLocator.primary.skillFamily;

            //If this is an alternate skill, use this code.
            // Here, we add our skill as a variant to the exisiting Skill Family.
            Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
            skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant
            {
                skillDef       = mySkillDef,
                unlockableName = "",
                viewableNode   = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null)
            };

            //Note; if your character does not originally have a skill family for this, use the following:
            //skillFamily.variants = new SkillFamily.Variant[1]; // substitute 1 for the number of skill variants you are implementing

            //If this is the default/first skill, copy this code and remove the //,
            //skillFamily.variants[0] = new SkillFamily.Variant
            //{
            //    skillDef = mySkillDef,
            //    unlockableName = "",
            //    viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null)
            //};
            #endregion
        }
Beispiel #25
0
        private void RegisterCharacter()
        {
            // now that the body prefab's set up, clone it here to make the display prefab
            characterDisplay = PrefabAPI.InstantiateClone(characterPrefab.GetComponent <ModelLocator>().modelBaseTransform.gameObject, "ExampleSurvivorDisplay", true, "C:\\Users\\test\\Documents\\ror2mods\\ExampleSurvivor\\ExampleSurvivor\\ExampleSurvivor\\ExampleSurvivor.cs", "RegisterCharacter", 153);
            characterDisplay.AddComponent <NetworkIdentity>();

            // clone rex's syringe projectile prefab here to use as our own projectile
            arrowProjectile = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/Projectiles/SyringeProjectile"), "Prefabs/Projectiles/ExampleArrowProjectile", true, "C:\\Users\\test\\Documents\\ror2mods\\ExampleSurvivor\\ExampleSurvivor\\ExampleSurvivor\\ExampleSurvivor.cs", "RegisterCharacter", 155);

            // just setting the numbers to 1 as the entitystate will take care of those
            arrowProjectile.GetComponent <ProjectileController>().procCoefficient = 1f;
            arrowProjectile.GetComponent <ProjectileDamage>().damage     = 1f;
            arrowProjectile.GetComponent <ProjectileDamage>().damageType = DamageType.Generic;

            // register it for networking
            if (arrowProjectile)
            {
                PrefabAPI.RegisterNetworkPrefab(arrowProjectile);
            }

            // add it to the projectile catalog or it won't work in multiplayer
            ProjectileCatalog.getAdditionalEntries += list =>
            {
                list.Add(arrowProjectile);
            };


            // write a clean survivor description here!
            string desc = "Example Survivor something something.<color=#CCD3E0>" + Environment.NewLine + Environment.NewLine;

            desc = desc + "< ! > Sample text 1." + Environment.NewLine + Environment.NewLine;
            desc = desc + "< ! > Sample text 2." + Environment.NewLine + Environment.NewLine;
            desc = desc + "< ! > Sample Text 3." + Environment.NewLine + Environment.NewLine;
            desc = desc + "< ! > Sample Text 4.</color>" + Environment.NewLine + Environment.NewLine;

            // add the language tokens
            LanguageAPI.Add("EXAMPLESURVIVOR_NAME", "Example Survivor");
            LanguageAPI.Add("EXAMPLESURVIVOR_DESCRIPTION", desc);
            LanguageAPI.Add("EXAMPLESURVIVOR_SUBTITLE", "Template for Custom Survivors");

            // add our new survivor to the game~
            SurvivorDef survivorDef = new SurvivorDef
            {
                name             = "EXAMPLESURVIVOR_NAME",
                unlockableName   = "",
                descriptionToken = "EXAMPLESURVIVOR_DESCRIPTION",
                primaryColor     = characterColor,
                bodyPrefab       = characterPrefab,
                displayPrefab    = characterDisplay
            };


            SurvivorAPI.AddSurvivor(survivorDef);

            // set up the survivor's skills here
            SkillSetup();

            // gotta add it to the body catalog too
            BodyCatalog.getAdditionalEntries += delegate(List <GameObject> list)
            {
                list.Add(characterPrefab);
            };
        }
Beispiel #26
0
        public static void CreateDireseeker()
        {
            if (DiggerPlugin.direseekerInstalled)
            {
                AddUnlockComponent();
            }

            if (DiggerPlugin.fatAcrid.Value)
            {
                PerroGrande();
            }

            CreateProjectiles();

            LanguageAPI.Add("DIRESEEKER_BODY_NAME", "Direseeker");
            LanguageAPI.Add("DIRESEEKER_BODY_SUBTITLE", "Track and Kill");
            //LanguageAPI.Add("DIRESEEKER_BODY_LORE", "Direseeker\n\nDireseeker is a giant Elder Lemurian that acts as a boss in the Stage 4 area Magma Barracks. Upon defeating it, the player will unlock the Miner character for future playthroughs. The path leading to Direseeker's location only appears in one of the three variants of the level, and even then Direseeker may or may not spawn with random chance. Completing the teleporter event will also prevent it from spawning.\nNote that in online co-op the boss may spawn for the Host, but not others, although they can still damage it.\nActivating the Artifact of Kin does not prevent it from appearing.\n\nCategories: Enemies | Bosses | Unlisted Enemies\n\nLanguages: Español");
            LanguageAPI.Add("DIRESEEKER_BODY_LORE", "Legends tell of a monstrous beast that once roamed the underground barracks of Petrichor V.\n\nFeared by the bravest of survivors and the nastiest of monsters, the massive beast was unrivaled. It donned blood-red scales, tempered by hellfire. It had burning yellow eyes, with a glare so intense it made the largest of creatures stop dead in their tracks. It had smoldering breath, hot enough to melt metal in an instant.\n\nOnly once stopped by a survivor strong enough to slay Providence himself, it was believed that the beast had finally met its match.\n\n<style=cIsHealth>Until it showed its terrifying face once again.</style>");
            LanguageAPI.Add("DIRESEEKER_BODY_OUTRO_FLAVOR", "..and so it left, in search of new prey.");

            //skills and states
            LoadoutAPI.AddSkill(typeof(EntityStates.Direseeker.SpawnState));
            LoadoutAPI.AddSkill(typeof(EntityStates.Direseeker.ChargeUltraFireball));
            LoadoutAPI.AddSkill(typeof(EntityStates.Direseeker.FireUltraFireball));

            if (!DiggerPlugin.direseekerInstalled)
            {
                bodyPrefab = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/CharacterBodies/LemurianBruiserBody"), "DireseekerBody");

                CharacterBody bodyComponent = bodyPrefab.GetComponent <CharacterBody>();

                bodyComponent.name              = "DireseekerBody";
                bodyComponent.baseNameToken     = "DIRESEEKER_BODY_NAME";
                bodyComponent.subtitleNameToken = "DIRESEEKER_BODY_SUBTITLE";
                bodyComponent.baseMoveSpeed     = 11f;
                bodyComponent.baseMaxHealth     = 2800f;
                bodyComponent.levelMaxHealth    = 840f;
                bodyComponent.baseDamage        = 20f;
                bodyComponent.levelDamage       = 4f;
                bodyComponent.isChampion        = true;
                bodyComponent.portraitIcon      = Assets.mainAssetBundle.LoadAsset <Sprite>("texDireseekerIcon").texture;

                SkillSetup(bodyPrefab);

                var stateMachine = bodyComponent.GetComponentInChildren <EntityStateMachine>();
                if (stateMachine)
                {
                    stateMachine.initialStateType = new SerializableEntityStateType(typeof(EntityStates.Direseeker.SpawnState));
                }

                //resize

                bodyPrefab.GetComponent <ModelLocator>().modelBaseTransform.gameObject.transform.localScale *= 1.5f;
                //bodyPrefab.GetComponent<ModelLocator>().modelBaseTransform.gameObject.transform.Translate(new Vector3(0f, 5.6f, 0f));

                foreach (KinematicCharacterMotor kinematicCharacterMotor in bodyPrefab.GetComponentsInChildren <KinematicCharacterMotor>())
                {
                    kinematicCharacterMotor.SetCapsuleDimensions(kinematicCharacterMotor.Capsule.radius * 1.5f, kinematicCharacterMotor.Capsule.height * 1.5f, 1.5f);
                }

                //

                CharacterModel model = bodyPrefab.GetComponentInChildren <CharacterModel>();

                Material newMat = UnityEngine.Object.Instantiate <Material>(model.baseRendererInfos[0].defaultMaterial);
                newMat.SetTexture("_MainTex", Assets.mainAssetBundle.LoadAsset <Material>("matDireseeker").GetTexture("_MainTex"));
                newMat.SetTexture("_EmTex", Assets.mainAssetBundle.LoadAsset <Material>("matDireseeker").GetTexture("_EmissionMap"));
                newMat.SetFloat("_EmPower", 50f);

                model.baseRendererInfos[0].defaultMaterial = newMat;

                GameObject horn1 = Assets.mainAssetBundle.LoadAsset <GameObject>("DireHorn").InstantiateClone("DireseekerHorn", false);
                GameObject horn2 = Assets.mainAssetBundle.LoadAsset <GameObject>("DireHornBroken").InstantiateClone("DireseekerHornBroken", false);
                //GameObject rageFlame = Assets.mainAssetBundle.LoadAsset<GameObject>("DireseekerRageFlame").InstantiateClone("DireseekerRageFlame", false);
                GameObject burstFlame = Assets.mainAssetBundle.LoadAsset <GameObject>("DireseekerBurstFlame").InstantiateClone("DireseekerBurstFlame", false);

                ChildLocator childLocator = bodyPrefab.GetComponentInChildren <ChildLocator>();

                horn1.transform.SetParent(childLocator.FindChild("Head"));
                horn1.transform.localPosition = new Vector3(-2.5f, 1, -0.5f);
                horn1.transform.localRotation = Quaternion.Euler(new Vector3(45, 0, 90));
                horn1.transform.localScale    = new Vector3(100, 100, 100);

                horn2.transform.SetParent(childLocator.FindChild("Head"));
                horn2.transform.localPosition = new Vector3(2.5f, 1, -0.5f);
                horn2.transform.localRotation = Quaternion.Euler(new Vector3(45, 0, 90));
                horn2.transform.localScale    = new Vector3(100, -100, 100);

                /*rageFlame.transform.SetParent(childLocator.FindChild("Head"));
                 * rageFlame.transform.localPosition = new Vector3(0, 1, 0);
                 * rageFlame.transform.localRotation = Quaternion.Euler(new Vector3(270, 180, 0));
                 * rageFlame.transform.localScale = new Vector3(5, 5, 5);*/

                burstFlame.transform.SetParent(childLocator.FindChild("Head"));
                burstFlame.transform.localPosition = new Vector3(0, 1, 0);
                burstFlame.transform.localRotation = Quaternion.Euler(new Vector3(270, 180, 0));
                burstFlame.transform.localScale    = new Vector3(5, 5, 5);

                bodyPrefab.AddComponent <DireseekerController>().burstFlame = burstFlame.GetComponent <ParticleSystem>();

                Shader hotpoo = Resources.Load <Shader>("Shaders/Deferred/hgstandard");

                Material hornMat = horn1.GetComponentInChildren <MeshRenderer>().material;
                hornMat.shader = hotpoo;

                //add horns

                CharacterModel.RendererInfo[] infos    = model.baseRendererInfos;
                CharacterModel.RendererInfo[] newInfos = new CharacterModel.RendererInfo[]
                {
                    infos[0],
                    new CharacterModel.RendererInfo
                    {
                        renderer                 = horn1.GetComponentInChildren <MeshRenderer>(),
                        defaultMaterial          = hornMat,
                        defaultShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On,
                        ignoreOverlays           = true
                    },
                    new CharacterModel.RendererInfo
                    {
                        renderer                 = horn2.GetComponentInChildren <MeshRenderer>(),
                        defaultMaterial          = hornMat,
                        defaultShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On,
                        ignoreOverlays           = true
                    }
                };

                model.baseRendererInfos = newInfos;

                masterPrefab = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/CharacterMasters/LemurianBruiserMaster"), "DireseekerMaster");

                CharacterMaster master = masterPrefab.GetComponent <CharacterMaster>();

                master.bodyPrefab = bodyPrefab;
                master.isBoss     = false;

                DiggerPlugin.bodyPrefabs.Add(bodyPrefab);
                DiggerPlugin.masterPrefabs.Add(masterPrefab);

                if (DiggerPlugin.enableDireseeker.Value && !DiggerPlugin.direseekerInstalled)
                {
                    CharacterSpawnCard characterSpawnCard = ScriptableObject.CreateInstance <CharacterSpawnCard>();
                    characterSpawnCard.name               = "cscDireseeker";
                    characterSpawnCard.prefab             = masterPrefab;
                    characterSpawnCard.sendOverNetwork    = true;
                    characterSpawnCard.hullSize           = HullClassification.BeetleQueen;
                    characterSpawnCard.nodeGraphType      = MapNodeGroup.GraphType.Ground;
                    characterSpawnCard.requiredFlags      = NodeFlags.None;
                    characterSpawnCard.forbiddenFlags     = NodeFlags.TeleporterOK;
                    characterSpawnCard.directorCreditCost = 800;
                    characterSpawnCard.occupyPosition     = false;
                    characterSpawnCard.loadout            = new SerializableLoadout();
                    characterSpawnCard.noElites           = true;
                    characterSpawnCard.forbiddenAsBoss    = false;

                    DirectorCard card = new DirectorCard
                    {
                        spawnCard               = characterSpawnCard,
                        selectionWeight         = 1,
                        allowAmbushSpawn        = false,
                        preventOverhead         = false,
                        minimumStageCompletions = 2,
                        spawnDistance           = DirectorCore.MonsterSpawnDistance.Close
                    };

                    DirectorAPI.DirectorCardHolder direseekerCard = new DirectorAPI.DirectorCardHolder
                    {
                        Card                 = card,
                        MonsterCategory      = DirectorAPI.MonsterCategory.Champions,
                        InteractableCategory = DirectorAPI.InteractableCategory.None
                    };

                    DirectorAPI.MonsterActions += delegate(List <DirectorAPI.DirectorCardHolder> list, DirectorAPI.StageInfo stage)
                    {
                        if (stage.stage == DirectorAPI.Stage.AbyssalDepths)
                        {
                            if (!list.Contains(direseekerCard))
                            {
                                list.Add(direseekerCard);
                            }
                        }
                    };
                }
            }

            if (DiggerPlugin.enableDireseekerSurvivor.Value)
            {
                survivorPrefab = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/CharacterBodies/LemurianBruiserBody"), "DireseekerPlayerBody");

                CharacterBody bodyComponent2 = survivorPrefab.GetComponent <CharacterBody>();

                bodyComponent2.name              = "DireseekerPlayerBody";
                bodyComponent2.baseNameToken     = "DIRESEEKER_BODY_NAME";
                bodyComponent2.subtitleNameToken = "DIRESEEKER_BODY_SUBTITLE";
                bodyComponent2.baseMoveSpeed     = 11f;
                bodyComponent2.baseMaxHealth     = 2200f;
                bodyComponent2.levelMaxHealth    = 800f;
                bodyComponent2.baseRegen         = 0.5f;
                bodyComponent2.levelRegen        = 0.2f;
                bodyComponent2.baseDamage        = 20f;
                bodyComponent2.levelDamage       = 4f;
                bodyComponent2.isChampion        = false;
                bodyComponent2.portraitIcon      = Assets.mainAssetBundle.LoadAsset <Sprite>("texDireseekerPlayerIcon").texture;
                bodyComponent2.hideCrosshair     = true;

                SkillSetup(survivorPrefab);

                var stateMachine = survivorPrefab.GetComponentInChildren <EntityStateMachine>();
                if (stateMachine)
                {
                    stateMachine.initialStateType = new SerializableEntityStateType(typeof(EntityStates.Direseeker.SpawnState));
                }

                //resize

                survivorPrefab.GetComponent <ModelLocator>().modelBaseTransform.gameObject.transform.localScale *= 0.75f;
                survivorPrefab.transform.GetChild(0).localPosition = new Vector3(0, -2.75f, 0);
                survivorPrefab.transform.GetChild(2).localPosition = new Vector3(0, 0.8f, 1.5f);

                foreach (KinematicCharacterMotor kinematicCharacterMotor in survivorPrefab.GetComponentsInChildren <KinematicCharacterMotor>())
                {
                    kinematicCharacterMotor.SetCapsuleDimensions(kinematicCharacterMotor.Capsule.radius * 0.75f, kinematicCharacterMotor.Capsule.height * 0.75f, 0.75f);
                }

                //

                CharacterModel model2 = survivorPrefab.GetComponentInChildren <CharacterModel>();

                Material newMat = UnityEngine.Object.Instantiate <Material>(model2.baseRendererInfos[0].defaultMaterial);
                newMat.SetTexture("_MainTex", Assets.mainAssetBundle.LoadAsset <Material>("matDireseeker").GetTexture("_MainTex"));
                newMat.SetTexture("_EmTex", Assets.mainAssetBundle.LoadAsset <Material>("matDireseeker").GetTexture("_EmissionMap"));
                newMat.SetFloat("_EmPower", 50f);

                model2.baseRendererInfos[0].defaultMaterial = newMat;

                GameObject horn1b = Assets.mainAssetBundle.LoadAsset <GameObject>("DireHorn").InstantiateClone("DireseekerHorn", false);
                GameObject horn2b = Assets.mainAssetBundle.LoadAsset <GameObject>("DireHornBroken").InstantiateClone("DireseekerHornBroken", false);
                //GameObject rageFlame = Assets.mainAssetBundle.LoadAsset<GameObject>("DireseekerRageFlame").InstantiateClone("DireseekerRageFlame", false);
                GameObject burstFlame2 = Assets.mainAssetBundle.LoadAsset <GameObject>("DireseekerBurstFlame").InstantiateClone("DireseekerBurstFlame", false);

                ChildLocator childLocator2 = survivorPrefab.GetComponentInChildren <ChildLocator>();

                horn1b.transform.SetParent(childLocator2.FindChild("Head"));
                horn1b.transform.localPosition = new Vector3(-2.5f, 1, -0.5f);
                horn1b.transform.localRotation = Quaternion.Euler(new Vector3(45, 0, 90));
                horn1b.transform.localScale    = new Vector3(100, 100, 100);

                horn2b.transform.SetParent(childLocator2.FindChild("Head"));
                horn2b.transform.localPosition = new Vector3(2.5f, 1, -0.5f);
                horn2b.transform.localRotation = Quaternion.Euler(new Vector3(45, 0, 90));
                horn2b.transform.localScale    = new Vector3(100, -100, 100);

                /*rageFlame.transform.SetParent(childLocator.FindChild("Head"));
                 * rageFlame.transform.localPosition = new Vector3(0, 1, 0);
                 * rageFlame.transform.localRotation = Quaternion.Euler(new Vector3(270, 180, 0));
                 * rageFlame.transform.localScale = new Vector3(5, 5, 5);*/

                burstFlame2.transform.SetParent(childLocator2.FindChild("Head"));
                burstFlame2.transform.localPosition = new Vector3(0, 1, 0);
                burstFlame2.transform.localRotation = Quaternion.Euler(new Vector3(270, 180, 0));
                burstFlame2.transform.localScale    = new Vector3(5, 5, 5);

                survivorPrefab.AddComponent <DireseekerController>().burstFlame = burstFlame2.GetComponent <ParticleSystem>();

                Shader hotpoo = Resources.Load <Shader>("Shaders/Deferred/hgstandard");

                Material hornMat = horn1b.GetComponentInChildren <MeshRenderer>().material;
                hornMat.shader = hotpoo;

                //add horns

                CharacterModel.RendererInfo[] infos2    = model2.baseRendererInfos;
                CharacterModel.RendererInfo[] newInfos2 = new CharacterModel.RendererInfo[]
                {
                    infos2[0],
                    new CharacterModel.RendererInfo
                    {
                        renderer                 = horn1b.GetComponentInChildren <MeshRenderer>(),
                        defaultMaterial          = hornMat,
                        defaultShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On,
                        ignoreOverlays           = true
                    },
                    new CharacterModel.RendererInfo
                    {
                        renderer                 = horn2b.GetComponentInChildren <MeshRenderer>(),
                        defaultMaterial          = hornMat,
                        defaultShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On,
                        ignoreOverlays           = true
                    }
                };

                model2.baseRendererInfos = newInfos2;

                survivorPrefab.GetComponent <DeathRewards>().logUnlockableDef     = null;
                survivorPrefab.GetComponent <Interactor>().maxInteractionDistance = 5f;

                survivorPrefab.tag = "Player";

                SkinSetup();

                DiggerPlugin.bodyPrefabs.Add(survivorPrefab);

                GameObject displayPrefab = PrefabAPI.InstantiateClone(survivorPrefab.GetComponent <ModelLocator>().modelTransform.gameObject, "DireseekerDisplay", true);
                displayPrefab.AddComponent <NetworkIdentity>();
                displayPrefab.transform.localScale *= 0.5f;

                SurvivorDef survivorDef = new SurvivorDef
                {
                    displayNameToken = "DIRESEEKER_BODY_NAME",
                    descriptionToken = "MINER_DESCRIPTION",
                    primaryColor     = Color.red,
                    bodyPrefab       = survivorPrefab,
                    displayPrefab    = displayPrefab,
                    outroFlavorToken = "DIRESEEKER_BODY_OUTRO_FLAVOR"
                };

                SurvivorAPI.AddSurvivor(survivorDef);
            }
        }
        private void RegisterCharacter()
        {
            //create a clone of the grovetender prefab
            myCharacter = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/CharacterBodies/GravekeeperBody"), "Prefabs/CharacterBodies/GrovetenderBody", true);
            //create a display prefab
            characterDisplay = PrefabAPI.InstantiateClone(myCharacter.GetComponent <ModelLocator>().modelBaseTransform.gameObject, "GrovetenderDisplay", true);

            //add custom menu animation script
            characterDisplay.AddComponent <MenuAnim>();

            //lets the grovetender be frozen
            var component1 = myCharacter.AddComponent <SetStateOnHurt>();

            component1.canBeHitStunned = false;
            component1.canBeStunned    = true;
            component1.canBeFrozen     = true;

            CharacterBody charBody = myCharacter.GetComponent <CharacterBody>();

            charBody.bodyFlags = CharacterBody.BodyFlags.ImmuneToExecutes;

            //swap to generic mainstate to fix clunky controls
            myCharacter.GetComponent <EntityStateMachine>().mainStateType = new SerializableEntityStateType(typeof(GenericCharacterMain));

            myCharacter.GetComponentInChildren <Interactor>().maxInteractionDistance = 5f;

            charBody.portraitIcon = Assets.charPortrait.texture;


            bool flag = originalSize.Value;

            if (!flag)
            {
                //resize the grovetender

                myCharacter.GetComponent <ModelLocator>().modelBaseTransform.gameObject.transform.localScale = Vector3.one * 0.3f;
                myCharacter.GetComponent <ModelLocator>().modelBaseTransform.gameObject.transform.Translate(new Vector3(0f, 5.6f, 0f));
                charBody.aimOriginTransform.Translate(new Vector3(0f, -2.5f, 0f));

                charBody.baseJumpPower            = Resources.Load <GameObject>("Prefabs/CharacterBodies/LoaderBody").GetComponent <CharacterBody>().baseJumpPower;
                charBody.baseMoveSpeed            = Resources.Load <GameObject>("Prefabs/CharacterBodies/LoaderBody").GetComponent <CharacterBody>().baseMoveSpeed;
                charBody.levelMoveSpeed           = Resources.Load <GameObject>("Prefabs/CharacterBodies/LoaderBody").GetComponent <CharacterBody>().levelMoveSpeed;
                charBody.sprintingSpeedMultiplier = Resources.Load <GameObject>("Prefabs/CharacterBodies/LoaderBody").GetComponent <CharacterBody>().sprintingSpeedMultiplier;

                myCharacter.GetComponentInChildren <CharacterMotor>().mass = 300;

                myCharacter.GetComponent <CameraTargetParams>().cameraParams = Resources.Load <GameObject>("Prefabs/CharacterBodies/CrocoBody").GetComponent <CameraTargetParams>().cameraParams;

                foreach (KinematicCharacterMotor kinematicCharacterMotor in myCharacter.GetComponentsInChildren <KinematicCharacterMotor>())
                {
                    kinematicCharacterMotor.SetCapsuleDimensions(kinematicCharacterMotor.Capsule.radius * 0.25f, kinematicCharacterMotor.Capsule.height * 0.25f, 0f);
                }
            }

            //crosshair stuff
            charBody.SetSpreadBloom(0, false);
            charBody.spreadBloomCurve     = Resources.Load <GameObject>("Prefabs/CharacterBodies/CommandoBody").GetComponent <CharacterBody>().spreadBloomCurve;
            charBody.spreadBloomDecayTime = Resources.Load <GameObject>("Prefabs/CharacterBodies/CommandoBody").GetComponent <CharacterBody>().spreadBloomDecayTime;

            charBody.hullClassification = HullClassification.Human;



            characterDisplay.transform.localScale = Vector3.one * 0.15f;
            characterDisplay.AddComponent <NetworkIdentity>();

            //create the custom crosshair
            grovetenderCrosshair = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/Crosshair/LoaderCrosshair"), "GrovetenderCrosshair", true);
            grovetenderCrosshair.AddComponent <NetworkIdentity>();
            Destroy(grovetenderCrosshair.GetComponent <LoaderHookCrosshairController>());
            //Destroy(grovetenderCrosshair.transform.GetChild(1));
            //Destroy(grovetenderCrosshair.transform.GetChild(0));

            //networking

            if (myCharacter)
            {
                PrefabAPI.RegisterNetworkPrefab(myCharacter);
            }
            if (characterDisplay)
            {
                PrefabAPI.RegisterNetworkPrefab(characterDisplay);
            }
            if (doppelganger)
            {
                PrefabAPI.RegisterNetworkPrefab(doppelganger);
            }
            if (grovetenderCrosshair)
            {
                PrefabAPI.RegisterNetworkPrefab(grovetenderCrosshair);
            }



            string desc = "The Grovetender is a slow, tanky survivor who makes use of Wisps to heal and deal damage.<color=#CCD3E0>" + Environment.NewLine + Environment.NewLine;

            desc = desc + "< ! > Disciple Swarm's low damage is made up for with its consistent item procs." + Environment.NewLine + Environment.NewLine;
            desc = desc + "< ! > Disciple Swarm can be held during your other skills." + Environment.NewLine + Environment.NewLine;
            desc = desc + "< ! > Piercing Wisp has the potential for massive heals when lined up right." + Environment.NewLine + Environment.NewLine;
            desc = desc + "< ! > Scorched Shotgun can be used to pull flying enemies into terrain for lethal impact damage.</color>" + Environment.NewLine;

            LanguageAPI.Add("GROVETENDER_NAME", "Grovetender");
            LanguageAPI.Add("GROVETENDER_DESCRIPTION", desc);
            LanguageAPI.Add("GROVETENDER_SUBTITLE", "Wisp Cultivator");


            charBody.name              = "GROVETENDER_NAME";
            charBody.baseNameToken     = "GROVETENDER_NAME";
            charBody.subtitleNameToken = "GROVETENDER_SUBTITLE";
            charBody.crosshairPrefab   = grovetenderCrosshair;

            charBody.baseMaxHealth  = baseHealth.Value;
            charBody.levelMaxHealth = healthGrowth.Value;
            charBody.baseRegen      = baseRegen.Value;
            charBody.levelRegen     = regenGrowth.Value;
            charBody.baseDamage     = baseDamage.Value;
            charBody.levelDamage    = damageGrowth.Value;
            charBody.baseArmor      = baseArmor.Value;
            charBody.levelArmor     = 1;
            charBody.baseCrit       = 1;

            charBody.preferredPodPrefab = Resources.Load <GameObject>("Prefabs/CharacterBodies/CrocoBody").GetComponent <CharacterBody>().preferredPodPrefab;


            //create a survivordef for our grovetender
            SurvivorDef survivorDef = new SurvivorDef
            {
                name             = "GROVETENDER_NAME",
                unlockableName   = "",
                descriptionToken = "GROVETENDER_DESCRIPTION",
                primaryColor     = CHAR_COLOR,
                bodyPrefab       = myCharacter,
                displayPrefab    = characterDisplay
            };


            SurvivorAPI.AddSurvivor(survivorDef);


            SkillSetup();


            //add it to the body catalog
            BodyCatalog.getAdditionalEntries += delegate(List <GameObject> list)
            {
                list.Add(myCharacter);
            };
        }
Beispiel #28
0
        public void Awake()
        {
            //IL.RoR2.CharacterMaster.OnBodyDeath += (il) =>
            //{
            //    ILCursor c = new ILCursor(il);
            //    c.GotoNext(
            //        x => x.MatchLdarg(0),
            //        x => x.MatchLdfld<CharacterMaster>("destroyOnBodyDeath"),
            //        x => x.MatchBrfalse(out _),
            //        x => x.MatchLdarg(0),
            //        x => x.MatchCallOrCallvirt<Component>("get_gameObject"),
            //        x => x.MatchLdcR4(1),
            //        x => x.MatchCallOrCallvirt<UnityEngine.Object>("Destroy"));
            //    c.Index += 1;
            //    c.RemoveRange(7);
            //};
            //On.RoR2.HurtBoxGroup.OnDeathStart += (orig, self) =>
            //{
            //    Chat.AddMessage("yahoo");
            //};
            //On.RoR2.CharacterAI.BaseAI.OnBodyDeath += (orig, self, test) =>
            //{
            //    Chat.AddMessage("dead ai");
            //};
            //On.RoR2.CharacterAI.BaseAI.OnBodyLost += (orig, self, test) =>
            //{
            //    Chat.AddMessage("dead ai");
            //};
            //////On.RoR2.HurtBoxGroup.SetHurtboxesActive += (orig, self, test) =>
            //////{
            //////    Chat.AddMessage("yay");
            //////};
            ////On.RoR2.BullseyeSearch.CheckVisible += (orig, self, test) =>
            ////{
            ////    return false;
            ////};

            //On.RoR2.HurtBox.OnDisable += (orig, self) =>
            //{
            //    Chat.AddMessage("OnDisable");
            //};

            //IL.RoR2.CameraRigController.Update += (il) => {
            //    var c = new ILCursor(il);

            //    //We use GotoNext to locate the code we want to edit
            //    //Notice we can specify a block of instructions to match, rather than only a single instruction
            //    //This is preferable as it is less likely to break something else because of an update

            //    c.GotoNext(
            //        x => x.MatchLdloc(4),      // num14 *= 0.5f;
            //        x => x.MatchLdcR4(0.5f),   //
            //        x => x.MatchMul(),         //
            //        x => x.MatchStloc(4),      //
            //        x => x.MatchLdloc(5),      // num15 *= 0.5f;
            //        x => x.MatchLdcR4(0.5f),   //
            //        x => x.MatchMul(),         //
            //        x => x.MatchStloc(5));     //

            //    //When we GotoNext, the cursor is before the first instruction we match.
            //    //So we remove the next 8 instructions
            //    c.RemoveRange(8);

            //};

            // myCharacter should either be
            // Resources.Load<GameObject>("prefabs/characterbodies/BanditBody");
            // or BodyCatalog.FindBodyIndex("BanditBody");
            this.characterPrefab = Resources.Load <GameObject>("prefabs/characterbodies/HuntressBody");

            // If you're confused about the language tokens, they're the proper way to add any strings used by the game.
            // We use AssetPlus API for that
            Languages.AddToken("MYBANDIT_DESCRIPTION", "The description of my survivor" + Environment.NewLine);

            var mySurvivorDef = new SurvivorDef
            {
                //We're finding the body prefab here,
                bodyPrefab = this.characterPrefab,
                //Description
                descriptionToken = "MYBANDIT_DESCRIPTION",
                //Display
                displayPrefab = Resources.Load <GameObject>("prefabs/characterdisplays/CommandoDisplay"),
                //Color on select screen
                primaryColor = new Color(0.8039216f, 0.482352942f, 0.843137264f),
                //Unlockable name
                unlockableName = "",
            };

            SurvivorAPI.AddSurvivor(mySurvivorDef);

            // If you're confused about the language tokens, they're the proper way to add any strings used by the game.
            // We use AssetPlus API for that
            Languages.AddToken("CHARACTERNAME_SKILLSLOT_SKILLNAME_NAME", "The name of this skill");
            Languages.AddToken("CHARACTERNAME_SKILLSLOT_SKILLNAME_DESCRIPTION", "The description of this skill.");



            //If this is the default/first skill, copy this code and remove the //,
            //skillFamily.variants[0] = new SkillFamily.Variant
            //{
            //    skillDef = mySkillDef,
            //    unlockableName = "",
            //    viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null)
            //};

            this.SkillSetup();
        }
Beispiel #29
0
        public void Awake()
        {
            myCharacter = Resources.Load <GameObject>("Prefabs/CharacterBodies/megadronebody").InstantiateClone("Prefabs/CharacterBodies/megadroneplayerbody");
            //Note; if your character cannot interact with things, play around with the following value after uncommenting them
            GameObject gameObject = myCharacter.GetComponent <ModelLocator>().modelBaseTransform.gameObject;

            myCharacter.transform.localScale *= 0.5f;
            myCharacter.GetComponent <CharacterBody>().aimOriginTransform.Translate(new Vector3(0, 0, 0));

            SkillLocator skillLocator = myCharacter.GetComponent <SkillLocator>();

            foreach (GenericSkill skill in myCharacter.GetComponentsInChildren <GenericSkill>())
            {
                DestroyImmediate(skill);
            }


            foreach (MonoBehaviour skill in myCharacter.GetComponentsInChildren <MonoBehaviour>())
            {
                Debug.Log(skill);

                if (skill as RoR2.RigidbodyStickOnImpact)
                {
                    DestroyImmediate(skill);
                }

                if (skill as CameraRigController)
                {
                    CameraRigController cameraRigController = skill as CameraRigController;

                    cameraRigController.cameraMode = CameraRigController.CameraMode.Fly;
                }
            }

            myCharacter.AddComponent <EquipmentSlot>();

            skillLocator.SetFieldValue <GenericSkill[]>("allSkills", new GenericSkill[0]);

            skillSetup();

            BodyCatalog.getAdditionalEntries += delegate(List <GameObject> list)
            {
                list.Add(myCharacter);
            };

            CharacterBody component = myCharacter.GetComponent <CharacterBody>();

            component.GetComponent <ModelLocator>().modelBaseTransform.GetComponentInChildren <SkinnedMeshRenderer>().material.DisableKeyword("EMISSION");

            component.baseDamage      = 6f;
            component.levelDamage     = 1.25f;
            component.baseCrit        = 1f;
            component.levelCrit       = 0;
            component.baseMaxHealth   = 90;
            component.levelMaxHealth  = 20f;
            component.baseArmor       = 5f;
            component.baseRegen       = 2f;
            component.levelRegen      = 0.1f;
            component.baseMoveSpeed   = 16f;
            component.baseAttackSpeed = 2f;
            component.baseNameToken   = "MyCharacterName";

            myCharacter.GetComponent <CharacterBody>().preferredPodPrefab = Resources.Load <GameObject>("Prefabs/CharacterBodies/toolbotbody").GetComponent <CharacterBody>().preferredPodPrefab;

            SurvivorDef survivorDef = new SurvivorDef
            {
                bodyPrefab       = myCharacter,
                descriptionToken = "MyDescription \r\n",
                displayPrefab    = myCharacter,
                primaryColor     = new Color(0.8039216f, 0.482352942f, 0.843137264f),
                name             = "MyCharacterName",
                unlockableName   = ""
            };

            SurvivorAPI.AddSurvivor(survivorDef);



            On.RoR2.EquipmentSlot.PerformEquipmentAction += (orig, self, equip) =>
            {
                Debug.Log(equip.ToString());
                return(orig(self, equip));
            };
        }
Beispiel #30
0
        private void RegisterCharacter()
        {
            // now that the body prefab's set up, clone it here to make the display prefab
            characterDisplay = PrefabAPI.InstantiateClone(characterPrefab.GetComponent <ModelLocator>().modelBaseTransform.gameObject, "ZukoDisplay", true, "D:\\Ror2Mod\\Zuko-RoR2-Mod\\ZukoProject\\Zuko.cs", "RegisterCharacter", 165);
            characterDisplay.AddComponent <NetworkIdentity>();

            // clone artificers firebolt projectile prefab here to use as our own projectile
            fireBallProjectile = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/Projectiles/MageFirebolt"), "Prefabs/Projectiles/ZukoFireBall", true, "D:\\Ror2Mod\\Zuko-RoR2-Mod\\ZukoProject\\Zuko.cs", "RegisterCharacter", 155);

            // just setting the numbers to 1 as the entitystate will take care of those
            fireBallProjectile.GetComponent <ProjectileController>().procCoefficient = 1f;
            fireBallProjectile.GetComponent <ProjectileDamage>().damage     = 1f;
            fireBallProjectile.GetComponent <ProjectileDamage>().damageType = DamageType.IgniteOnHit;

            // register it for networking
            if (fireBallProjectile)
            {
                PrefabAPI.RegisterNetworkPrefab(fireBallProjectile);
            }

            // add it to the projectile catalog or it won't work in multiplayer
            ProjectileCatalog.getAdditionalEntries += list =>
            {
                list.Add(fireBallProjectile);
            };


            // write a clean survivor description here!
            string desc = "Example Survivor something something.<color=#CCD3E0>" + Environment.NewLine + Environment.NewLine;

            desc = desc + "< ! > Sample text 1." + Environment.NewLine + Environment.NewLine;
            desc = desc + "< ! > Sample text 2." + Environment.NewLine + Environment.NewLine;
            desc = desc + "< ! > Sample Text 3." + Environment.NewLine + Environment.NewLine;
            desc = desc + "< ! > Sample Text 4.</color>" + Environment.NewLine + Environment.NewLine;

            // add the language tokens
            LanguageAPI.Add("ZUKO_NAME", "Zuko");
            LanguageAPI.Add("ZUKO_DESCRIPTION", desc);
            LanguageAPI.Add("ZUKO_SUBTITLE", "Zuko from Avatar: The Last Airbender");

            // add our new survivor to the game~
            SurvivorDef survivorDef = new SurvivorDef
            {
                name             = "ZUKO_NAME",
                unlockableName   = "",
                descriptionToken = "ZUKO_DESCRIPTION",
                primaryColor     = characterColor,
                bodyPrefab       = characterPrefab,
                displayPrefab    = characterDisplay
            };


            SurvivorAPI.AddSurvivor(survivorDef);

            // set up the survivor's skills here
            SkillSetup();

            // gotta add it to the body catalog too
            BodyCatalog.getAdditionalEntries += delegate(List <GameObject> list)
            {
                list.Add(characterPrefab);
            };
        }