Пример #1
0
        private static void CharacterBody_Start(On.RoR2.CharacterBody.orig_Start orig, CharacterBody self)
        {
            orig(self);
            if (NetworkServer.active && RunArtifactManager.instance.IsArtifactEnabled(ArtifactOfGenetics.artifactDef))
            {
                if (instance == null) //Emergency Catch for Bulwark Edge Case
                {
                    Run.instance.gameObject.AddComponent <GeneEngineDriver>();
                    GeneticsArtifactPlugin.geneticLogSource.LogWarning("GeneEngineDriver Emergency Activation! Wasn't ready for a body yet.");
                }
                if (self.teamComponent.teamIndex == TeamIndex.Monster &&
                    self.inventory)
                {
                    if (!masterGenes.Exists(x => x.bodyIndex == self.bodyIndex))
                    {
                        MasterGeneBehaviour newMaster = new MasterGeneBehaviour();
                        newMaster.Init();
                        newMaster.bodyIndex = self.bodyIndex;
                        masterGenes.Add(newMaster);
                        GeneticsArtifactPlugin.geneticLogSource.LogInfo("Generated a Master Template for: " + BodyCatalog.GetBodyName(self.bodyIndex));
                    }

                    MonsterGeneBehaviour geneBehaviour = self.gameObject.AddComponent <MonsterGeneBehaviour>();
                    geneBehaviour.MutateFromMaster();
                }
            }
        }
Пример #2
0
        private void CopyFromMaster()
        {
            MasterGeneBehaviour master = GeneEngineDriver.masterGenes.Find(x => x.bodyIndex == bodyIndex);

            currentGenes = new Dictionary <GeneStat, float>(master.templateGenes);
        }