コード例 #1
0
ファイル: Effects.cs プロジェクト: Reinms/RoR2Modding
        private void CreateKnifeBlinkEffect()
        {
            this.knifeBlink = EntityStates.Huntress.BlinkState.blinkPrefab.InstantiateClone("KinfeBink", false);


            EffectAPI.AddEffect(this.knifeBlink);
        }
コード例 #2
0
ファイル: Effects.cs プロジェクト: Reinms/RoR2Modding
        private void CreateKnifeSlashEffect()
        {
            this.knifeSlash = EntityStates.Merc.WhirlwindBase.swingEffectPrefab.InstantiateClone("KnifeSlash", false);
            this.knifeSlash.transform.Find("SwingTrail").localScale *= 5f;
            this.knifeSlash.transform.Find("Distortion").localScale *= 5f;

            EffectAPI.AddEffect(this.knifeSlash);
        }
コード例 #3
0
        internal static void PopulateAssets()
        {
            if (mainAssetBundle == null)
            {
                using (var assetStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("HenryMod.pleasechangethisnameinyourprojectorelseyouwillcauseconflicts"))
                {
                    mainAssetBundle = AssetBundle.LoadFromStream(assetStream);
                    var provider = new AssetBundleResourcesProvider("@Henry", mainAssetBundle);
                    ResourcesAPI.AddProvider(provider);
                }
            }

            using (Stream manifestResourceStream2 = Assembly.GetExecutingAssembly().GetManifestResourceStream("HenryMod.HenryBank.bnk"))
            {
                byte[] array = new byte[manifestResourceStream2.Length];
                manifestResourceStream2.Read(array, 0, array.Length);
                SoundAPI.SoundBanks.Add(array);
            }

            swordHitSoundEvent = CreateNetworkSoundEventDef("HenrySwordHit");
            punchHitSoundEvent = CreateNetworkSoundEventDef("HenryPunchHit");

            dustEffect          = LoadEffect("HenryDustEffect");
            bombExplosionEffect = LoadEffect("BombExplosionEffect");

            ShakeEmitter shakeEmitter = bombExplosionEffect.AddComponent <ShakeEmitter>();

            shakeEmitter.amplitudeTimeDecay             = true;
            shakeEmitter.duration                       = 0.5f;
            shakeEmitter.radius                         = 200f;
            shakeEmitter.scaleShakeRadiusWithLocalScale = false;

            shakeEmitter.wave = new Wave
            {
                amplitude   = 1f,
                frequency   = 40f,
                cycleOffset = 0f
            };

            swordSwingEffect     = Assets.LoadEffect("HenrySwordSwingEffect");
            swordHitImpactEffect = Assets.LoadEffect("ImpactHenrySlash");

            punchSwingEffect = Assets.LoadEffect("HenryFistSwingEffect");
            //punchImpactEffect = Assets.LoadEffect("ImpactHenryPunch");
            // on second thought my effect sucks so imma just clone loader's
            punchImpactEffect = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/Effects/OmniEffect/OmniImpactVFXLoader"), "ImpactHenryPunch");
            punchImpactEffect.AddComponent <NetworkIdentity>();

            EffectAPI.AddEffect(punchImpactEffect);
        }
コード例 #4
0
        private GameObject CreateIceExplosionEffect()
        {
            this.CreateIceBombTex();

            GameObject             obj    = Resources.Load <GameObject>("Prefabs/Effects/ImpactEffects/AffixWhiteExplosion").InstantiateClone("IceExplosion", false);
            ParticleSystemRenderer sphere = obj.transform.Find("Nova Sphere").GetComponent <ParticleSystemRenderer>();
            Material mat = UnityEngine.Object.Instantiate <Material>(sphere.material);

            mat.SetTexture("_RemapTex", this.iceBombTex);
            sphere.material = mat;

            _ = EffectAPI.AddEffect(obj);
            return(obj);
        }
コード例 #5
0
        private static void CreateRocket()
        {
            templarRocketPrefab = CloneProjectilePrefab("Prefabs/Projectiles/LemurianBigFireball", "TemplarRocketProjectile");
            templarRocketPrefab.GetComponent <ProjectileImpactExplosion>().blastDamageCoefficient = 1f;
            templarRocketPrefab.GetComponent <ProjectileImpactExplosion>().blastRadius            = Modules.Config.bazookaBlastRadius.Value;
            templarRocketPrefab.GetComponent <ProjectileImpactExplosion>().blastProcCoefficient   = Modules.Config.bazookaProcCoefficient.Value;
            templarRocketPrefab.GetComponent <ProjectileImpactExplosion>().destroyOnEnemy         = true;
            templarRocketPrefab.GetComponent <ProjectileImpactExplosion>().destroyOnWorld         = true;
            bool flag = templarRocketPrefab.GetComponent <MissileController>() != null;

            if (flag)
            {
                Object.Destroy(templarRocketPrefab.GetComponent <MissileController>());
            }
            templarRocketPrefab.AddComponent <TemplarMissileController>();
            GameObject gameObject2 = PrefabAPI.InstantiateClone(Assets.clayMissileModel, "TemplarMissileModel", true, "C:\\Users\\rseid\\Documents\\ror2mods\\PlayableTemplar\\PlayableTemplar\\cs", "RegisterTemplar", 580);

            gameObject2.AddComponent <NetworkIdentity>();
            gameObject2.AddComponent <ProjectileGhostController>();
            gameObject2.transform.GetChild(1).SetParent(gameObject2.transform.GetChild(0));
            gameObject2.transform.GetChild(0).localRotation = Quaternion.Euler(0f, 90f, 0f);
            gameObject2.transform.GetChild(0).localScale   *= 0.5f;
            gameObject2.transform.GetChild(0).GetChild(0).GetChild(0).SetParent(gameObject2.transform.GetChild(0));
            GameObject gameObject3 = gameObject2.transform.GetChild(0).GetChild(0).gameObject;

            gameObject3.AddComponent <TemplarSeparateFromParent>();
            gameObject3.transform.localScale *= 0.8f;
            templarRocketPrefab.GetComponent <ProjectileController>().ghostPrefab = gameObject2;
            templarRocketEffect = PrefabAPI.InstantiateClone(templarRocketPrefab.GetComponent <ProjectileImpactExplosion>().impactEffect, "TemplarRocketImpact", true, "C:\\Users\\rseid\\Documents\\ror2mods\\PlayableTemplar\\PlayableTemplar\\cs", "RegisterTemplar", 664);
            templarRocketEffect.AddComponent <NetworkIdentity>();
            bool value2 = Modules.Config.enableRocketJump.Value;

            if (value2)
            {
                templarRocketEffect.AddComponent <TemplarExplosionForce>();
            }
            bool flag2 = templarRocketEffect.GetComponent <VFXAttributes>();

            if (flag2)
            {
                templarRocketEffect.GetComponent <VFXAttributes>().vfxPriority = VFXAttributes.VFXPriority.Always;
            }
            EffectAPI.AddEffect(templarRocketEffect);
            templarRocketPrefab.GetComponent <ProjectileImpactExplosion>().impactEffect = templarRocketEffect;
            templarRocketPrefab.GetComponent <ProjectileDamage>().damageType            = DamageType.BypassOneShotProtection;
        }
コード例 #6
0
ファイル: Assets.cs プロジェクト: dgosling/HenryMod
        private static GameObject LoadEffect(string resourceName, string soundName)
        {
            GameObject newEffect = mainAssetBundle.LoadAsset <GameObject>(resourceName);

            newEffect.AddComponent <DestroyOnTimer>().duration = 12;
            newEffect.AddComponent <NetworkIdentity>();
            newEffect.AddComponent <VFXAttributes>().vfxPriority = VFXAttributes.VFXPriority.Always;
            var effect = newEffect.AddComponent <EffectComponent>();

            effect.applyScale  = false;
            effect.effectIndex = EffectIndex.Invalid;
            effect.parentToReferencedTransform   = true;
            effect.positionAtReferencedTransform = true;
            effect.soundName = soundName;

            EffectAPI.AddEffect(newEffect);

            return(newEffect);
        }
コード例 #7
0
        public static void CreateShockEffect()
        {
            shockEffect = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("prefabs/effects/impacteffects/LightningStrikeImpact"), "OriginalJellyshockEffect", true);;
            //var ukuEffect = Resources.Load<GameObject>("Prefabs/Effects/OrbEffects/LightningOrbEffect");
            shockEffect.transform.localScale *= 0.25f;
            Destroy(shockEffect.transform.Find("LightningRibbon").gameObject);
            shockEffect.transform.Find("Flash").transform.localScale *= 0.5f;
            Destroy(shockEffect.GetComponent <EffectComponent>());
            shockEffect.AddComponent <EffectComponent>();
            //shockEffect.GetComponent<EffectComponent>().soundName = ukuEffect.GetComponent<EffectComponent>().soundName;

            Debug.Log("Adding shock effect to prefab");
            if (EffectAPI.AddEffect(shockEffect))
            {
                Debug.Log("Added!");
            }
            else
            {
                Debug.LogWarning("Did not add!");
            }
        }
コード例 #8
0
ファイル: Effects.cs プロジェクト: Reinms/RoR2Modding
        private void CreateTracerEffect()
        {
            //this.primaryTracer = CreateGenericTracer( "SniperPrimaryTracer", false, false );

            //var line = this.primaryTracer.GetComponent<LineRenderer>();

            this.primaryTracer = Resources.Load <GameObject>("Prefabs/Effects/Tracers/TracerHuntressSnipe").InstantiateClone("SniperPrimaryTracer", false);

            var trace = this.primaryTracer.GetComponent <Tracer>();

            Destroy(trace.headTransform.gameObject);
            Destroy(trace.tailTransform.gameObject);

            //trace.onTailReachedDestination.RemoveAllListeners();

            var fx = this.primaryTracer.AddComponent <VFXAttributes>();

            fx.vfxIntensity = VFXAttributes.VFXIntensity.Low;
            fx.vfxPriority  = VFXAttributes.VFXPriority.Always;

            EffectAPI.AddEffect(this.primaryTracer);
        }
コード例 #9
0
        public static void Initialize()
        {
            poopslingerExplosionEffect = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("prefabs/effects/impacteffects/BeetleSpitExplosion"), "PoopslingerExplosionEffect", true);
            if (!poopslingerExplosionEffect.GetComponent <NetworkIdentity>())
            {
                poopslingerExplosionEffect.AddComponent <NetworkIdentity>();
            }
            poopslingerExplosionEffect.GetComponent <EffectComponent>().soundName = Assets.PoopslingerHitSound;
            EffectAPI.AddEffect(poopslingerExplosionEffect);

            sacrificeBaseEffect = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("prefabs/effects/ArtifactShellExplosion"), "SacrificeBaseEffect", true);
            if (!sacrificeBaseEffect.GetComponent <NetworkIdentity>())
            {
                sacrificeBaseEffect.AddComponent <NetworkIdentity>();
            }
            sacrificeBaseEffect.GetComponentInChildren <UnityEngine.Rendering.PostProcessing.PostProcessVolume>().blendDistance = 100f;
            sacrificeBaseEffect.transform.Find("AreaIndicator").gameObject.SetActive(false);
            sacrificeBaseEffect.transform.Find("Vacuum Stars, Distortion").gameObject.SetActive(false);
            sacrificeBaseEffect.transform.Find("Point light").gameObject.SetActive(false);
            EffectAPI.AddEffect(sacrificeBaseEffect);

            sacrificeStanEffect = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("prefabs/effects/ArtifactShellExplosion"), "SacrificeStanEffect", true);
            if (!sacrificeStanEffect.GetComponent <NetworkIdentity>())
            {
                sacrificeStanEffect.AddComponent <NetworkIdentity>();
            }
            sacrificeBaseEffect.GetComponentInChildren <UnityEngine.Rendering.PostProcessing.PostProcessVolume>().blendDistance = 100f;
            sacrificeStanEffect.transform.Find("Point light").gameObject.SetActive(false);
            EffectAPI.AddEffect(sacrificeStanEffect);

            weakStanBurnEffect = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("prefabs/effects/impacteffects/Explosionsolarflare"), "WeakStanBurnEffect", true);
            if (!weakStanBurnEffect.GetComponent <NetworkIdentity>())
            {
                weakStanBurnEffect.AddComponent <NetworkIdentity>();
            }
            weakStanBurnEffect.GetComponent <EffectComponent>().soundName = "";
            EffectAPI.AddEffect(weakStanBurnEffect);
        }
コード例 #10
0
        public override void SetupAttributes()
        {
            if (ItemBodyModelPrefab == null)
            {
                ItemBodyModelPrefab = Resources.Load <GameObject>(modelResourcePath);
                displayRules        = GenerateItemDisplayRules();
            }
            base.SetupAttributes();

            NetworkingAPI.RegisterMessageType <SyncJarOrb>();
            NetworkingAPI.RegisterMessageType <SyncJarSucking>();
            NetworkingAPI.RegisterMessageType <SyncJarCharging>();

            JarChargeSphere = Resources.Load <GameObject>("@Aetherium:Assets/Models/Prefabs/JarOfReshapingAbsorbEffect.prefab");

            var chargeSphereEffectComponent = JarChargeSphere.AddComponent <RoR2.EffectComponent>();

            chargeSphereEffectComponent.parentToReferencedTransform   = true;
            chargeSphereEffectComponent.positionAtReferencedTransform = true;

            var chargeSphereTimer = JarChargeSphere.AddComponent <RoR2.DestroyOnTimer>();

            chargeSphereTimer.duration = projectileAbsorptionTime;

            var chargeSphereVfxAttributes = JarChargeSphere.AddComponent <RoR2.VFXAttributes>();

            chargeSphereVfxAttributes.vfxIntensity = RoR2.VFXAttributes.VFXIntensity.Low;
            chargeSphereVfxAttributes.vfxPriority  = RoR2.VFXAttributes.VFXPriority.Medium;

            JarChargeSphere.AddComponent <NetworkIdentity>();
            if (JarChargeSphere)
            {
                PrefabAPI.RegisterNetworkPrefab(JarChargeSphere);
            }
            EffectAPI.AddEffect(JarChargeSphere);
            //JarOrbProjectile = PrefabAPI.InstantiateClone(Resources.Load<GameObject>())

            JarOrb = Resources.Load <GameObject>("@Aetherium:Assets/Models/Prefabs/JarOfReshapingOrb.prefab");

            var jarOrbEffectComponent = JarOrb.AddComponent <RoR2.EffectComponent>();

            var vfxAttributes = JarOrb.AddComponent <RoR2.VFXAttributes>();

            vfxAttributes.vfxIntensity = RoR2.VFXAttributes.VFXIntensity.Low;
            vfxAttributes.vfxPriority  = RoR2.VFXAttributes.VFXPriority.Medium;

            var orbEffect = JarOrb.AddComponent <OrbEffect>();

            orbEffect.startEffect    = Resources.Load <GameObject>("Prefabs/Effects/ShieldBreakEffect");
            orbEffect.endEffect      = Resources.Load <GameObject>("Prefabs/Effects/MuzzleFlashes/MuzzleFlashMageIce");
            orbEffect.startVelocity1 = new Vector3(-10, 10, -10);
            orbEffect.startVelocity2 = new Vector3(10, 13, 10);
            orbEffect.endVelocity1   = new Vector3(-10, 0, -10);
            orbEffect.endVelocity2   = new Vector3(10, 5, 10);
            orbEffect.movementCurve  = AnimationCurve.EaseInOut(0, 0, 1, 1);

            JarOrb.AddComponent <NetworkIdentity>();

            if (JarOrb)
            {
                PrefabAPI.RegisterNetworkPrefab(JarOrb);
            }
            EffectAPI.AddEffect(JarOrb);

            OrbAPI.AddOrb(typeof(JarOfReshapingOrb));

            JarProjectile = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/Projectiles/PaladinRocket"), "JarOfReshapingProjectile", true);

            var model = Resources.Load <GameObject>("@Aetherium:Assets/Models/Prefabs/JarOfReshapingProjectile.prefab");

            model.AddComponent <NetworkIdentity>();
            model.AddComponent <ProjectileGhostController>();

            var controller = JarProjectile.GetComponent <RoR2.Projectile.ProjectileController>();

            controller.procCoefficient = 1;
            controller.ghostPrefab     = model;

            JarProjectile.GetComponent <RoR2.TeamFilter>().teamIndex = TeamIndex.Neutral;

            var damage = JarProjectile.GetComponent <RoR2.Projectile.ProjectileDamage>();

            damage.damageType = DamageType.Generic;
            damage.damage     = 0;

            var impactExplosion = JarProjectile.GetComponent <RoR2.Projectile.ProjectileImpactExplosion>();

            impactExplosion.destroyOnEnemy       = true;
            impactExplosion.destroyOnWorld       = true;
            impactExplosion.impactEffect         = Resources.Load <GameObject>("Prefabs/Effects/BrittleDeath");
            impactExplosion.blastRadius          = 4;
            impactExplosion.blastProcCoefficient = 1f;

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

            // add it to the projectile catalog or it won't work in multiplayer
            RoR2.ProjectileCatalog.getAdditionalEntries += list =>
            {
                list.Add(JarProjectile);
            };
        }
コード例 #11
0
ファイル: Assets.cs プロジェクト: LoganCary/TestCharacter
        public static void PopulateAssets()
        {
            if (mainAssetBundle == null)
            {
                using (var assetStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("PaladinMod.paladin"))
                {
                    mainAssetBundle = AssetBundle.LoadFromStream(assetStream);
                    var provider = new AssetBundleResourcesProvider("@Paladin", mainAssetBundle);
                    ResourcesAPI.AddProvider(provider);
                }
            }

            using (Stream manifestResourceStream2 = Assembly.GetExecutingAssembly().GetManifestResourceStream("PaladinMod.PaladinBank.bnk"))
            {
                byte[] array = new byte[manifestResourceStream2.Length];
                manifestResourceStream2.Read(array, 0, array.Length);
                SoundAPI.SoundBanks.Add(array);
            }

            #region Icons
            charPortrait = mainAssetBundle.LoadAsset <Sprite>("texPaladinIcon").texture;

            iconP   = mainAssetBundle.LoadAsset <Sprite>("PassiveIcon");
            icon1   = mainAssetBundle.LoadAsset <Sprite>("SlashIcon");
            icon2   = mainAssetBundle.LoadAsset <Sprite>("SpinSlashIcon");
            icon2b  = mainAssetBundle.LoadAsset <Sprite>("LightningSpearIcon");
            icon2c  = mainAssetBundle.LoadAsset <Sprite>("LunarShardIcon");
            icon3   = mainAssetBundle.LoadAsset <Sprite>("DashIcon");
            icon3b  = mainAssetBundle.LoadAsset <Sprite>("HealIcon");
            icon4   = mainAssetBundle.LoadAsset <Sprite>("HealZoneIcon");
            icon4b  = mainAssetBundle.LoadAsset <Sprite>("TorporIcon");
            icon4c  = mainAssetBundle.LoadAsset <Sprite>("WarcryIcon");
            icon4S  = mainAssetBundle.LoadAsset <Sprite>("ScepterHealZoneIcon");
            icon4bS = mainAssetBundle.LoadAsset <Sprite>("ScepterTorporIcon");
            icon4cS = mainAssetBundle.LoadAsset <Sprite>("ScepterWarcryIcon");
            #endregion

            #region ProjectileGhosts
            lightningSpear = mainAssetBundle.LoadAsset <GameObject>("LightningSpear");
            swordBeam      = mainAssetBundle.LoadAsset <GameObject>("SwordBeam");
            swordBeamGhost = mainAssetBundle.LoadAsset <GameObject>("SwordBeamGhost");
            swordBeamGhost.AddComponent <ProjectileGhostController>();
            tornadoEffect = mainAssetBundle.LoadAsset <GameObject>("PaladinTornadoEffect");
            tornadoEffect.AddComponent <ProjectileGhostController>();
            #endregion

            #region SpellEffects
            healEffectPrefab     = mainAssetBundle.LoadAsset <GameObject>("HealEffect");
            healZoneEffectPrefab = mainAssetBundle.LoadAsset <GameObject>("HealZoneEffect");
            torporEffectPrefab   = mainAssetBundle.LoadAsset <GameObject>("TorporEffect");
            warcryEffectPrefab   = mainAssetBundle.LoadAsset <GameObject>("HealZoneEffect").InstantiateClone("WarcryEffect", false);

            GameObject engiShieldObj = Resources.Load <GameObject>("Prefabs/Projectiles/EngiBubbleShield");

            Material shieldFillMat  = UnityEngine.Object.Instantiate <Material>(engiShieldObj.transform.Find("Collision").Find("ActiveVisual").GetComponent <MeshRenderer>().material);
            Material shieldOuterMat = UnityEngine.Object.Instantiate <Material>(engiShieldObj.transform.Find("Collision").Find("ActiveVisual").Find("Edge").GetComponent <MeshRenderer>().material);

            GameObject voidExplosionObj = Resources.Load <GameObject>("Prefabs/Effects/NullifierDeathExplosion");//DeathExplosion
            Material   voidMat          = voidExplosionObj.transform.Find("AreaIndicator (1)").GetComponent <ParticleSystemRenderer>().material;
            torporMat = voidMat;

            GameObject healNovaObj = Resources.Load <GameObject>("Prefabs/Effects/TPHealNovaEffect");
            Material   healMat     = healNovaObj.transform.Find("AreaIndicator").GetComponent <ParticleSystemRenderer>().material;

            healZoneEffectPrefab.transform.GetChild(0).GetComponent <ParticleSystemRenderer>().material             = shieldOuterMat;
            healZoneEffectPrefab.transform.GetChild(0).GetChild(0).GetComponent <ParticleSystemRenderer>().material = healMat;

            torporEffectPrefab.transform.GetChild(0).GetComponent <ParticleSystemRenderer>().material = voidMat;

            warcryEffectPrefab.transform.GetChild(0).GetComponent <ParticleSystemRenderer>().material = shieldOuterMat;
            warcryEffectPrefab.transform.GetChild(0).GetComponent <ParticleSystemRenderer>().material.SetColor("_TintColor", Color.red);
            warcryEffectPrefab.transform.GetChild(0).GetChild(0).GetComponent <ParticleSystemRenderer>().material = Resources.Load <Material>("materials/matFullCrit");
            //
            //GameObject warbannerEffect = Resources.Load<GameObject>("Prefabs/NetworkedObjects/WarbannerWard").InstantiateClone("x", true);
            #endregion

            #region SwordEffects
            swordSwing               = Assets.LoadEffect("PaladinSwing", "");
            spinningSlashFX          = Assets.LoadEffect("SpinSlashEffect", "");
            spinningSlashEmpoweredFX = Assets.LoadEffect("EmpSpinSlashEffect", "");
            hitFX = Assets.LoadEffect("ImpactPaladinSwing", "");

            swordSwingGreen               = Assets.LoadEffect("PaladinSwingGreen", "");
            spinningSlashFXGreen          = Assets.LoadEffect("SpinSlashEffectGreen", "");
            spinningSlashEmpoweredFXGreen = Assets.LoadEffect("EmpSpinSlashEffectGreen", "");
            hitFXGreen = Assets.LoadEffect("ImpactPaladinSwingGreen", "");

            swordSwingYellow               = Assets.LoadEffect("PaladinSwingYellow", "");
            spinningSlashFXYellow          = Assets.LoadEffect("SpinSlashEffectYellow", "");
            spinningSlashEmpoweredFXYellow = Assets.LoadEffect("EmpSpinSlashEffectYellow", "");
            hitFXYellow = Assets.LoadEffect("ImpactPaladinSwingYellow", "");

            swordSwingWhite = Assets.LoadEffect("PaladinSwingWhite", "");
            hitFXBlunt      = Assets.LoadEffect("ImpactPaladinSwingBlunt", "");

            swordSwingBat = Assets.LoadEffect("PaladinSwingBat", "");

            swordSwingRed               = Assets.LoadEffect("PaladinSwingRed", "");
            spinningSlashFXRed          = Assets.LoadEffect("SpinSlashEffectRed", "");
            spinningSlashEmpoweredFXRed = Assets.LoadEffect("EmpSpinSlashEffectRed", "");
            hitFXRed = Assets.LoadEffect("ImpactPaladinSwingRed", "");

            swordSwingClay               = Assets.LoadEffect("PaladinSwingClay", "");
            spinningSlashFXClay          = Assets.LoadEffect("SpinSlashEffectClay", "");
            spinningSlashEmpoweredFXClay = Assets.LoadEffect("EmpSpinSlashEffectClay", "");
            hitFXClay = Assets.LoadEffect("ImpactPaladinSwingClay", "");

            swordSwingPurple               = Assets.LoadEffect("PaladinSwingPurple", "");
            spinningSlashFXPurple          = Assets.LoadEffect("SpinSlashEffectPurple", "");
            spinningSlashEmpoweredFXPurple = Assets.LoadEffect("EmpSpinSlashEffectPurple", "");
            hitFXPurple = Assets.LoadEffect("ImpactPaladinSwingPurple", "");

            swordSwingFlame               = Assets.LoadEffect("PaladinSwingFlame", "");
            spinningSlashFXFlame          = Assets.LoadEffect("SpinSlashEffectFlame", "");
            spinningSlashEmpoweredFXFlame = Assets.LoadEffect("EmpSpinSlashEffectFlame", "");

            swordSwingBlack               = Assets.LoadEffect("PaladinSwingBlack", "");
            spinningSlashFXBlack          = Assets.LoadEffect("SpinSlashEffectBlack", "");
            spinningSlashEmpoweredFXBlack = Assets.LoadEffect("EmpSpinSlashEffectBlack", "");
            hitFXBlack = Assets.LoadEffect("ImpactPaladinSwingBlack", "");
            #endregion

            #region MiscEffects
            lightningHitFX    = Assets.LoadEffect("LightningHitFX", "");
            lightningImpactFX = Assets.LoadEffect("LightningImpact", "Play_mage_R_lightningBlast");
            torporVoidFX      = Assets.LoadEffect("TorporVoidFX", "RoR2_nullifier_attack1_explode_02");
            #endregion

            #region Meshes
            defaultMesh      = mainAssetBundle.LoadAsset <Mesh>("meshPaladin");
            defaultSwordMesh = mainAssetBundle.LoadAsset <Mesh>("meshSword");
            lunarMesh        = mainAssetBundle.LoadAsset <Mesh>("meshLunarPaladin");
            lunarSwordMesh   = mainAssetBundle.LoadAsset <Mesh>("meshLunarSword");
            poisonMesh       = mainAssetBundle.LoadAsset <Mesh>("meshNkuhanaPaladin");
            poisonSwordMesh  = mainAssetBundle.LoadAsset <Mesh>("meshNkuhanaSword");
            //hunterMesh = mainAssetBundle.LoadAsset<Mesh>("HunterMesh");
            dripMesh           = mainAssetBundle.LoadAsset <Mesh>("meshDripPaladin");
            batMesh            = mainAssetBundle.LoadAsset <Mesh>("meshBat");
            clayMesh           = mainAssetBundle.LoadAsset <Mesh>("meshClayPaladin");
            claySwordMesh      = mainAssetBundle.LoadAsset <Mesh>("meshClaySword");
            minecraftMesh      = mainAssetBundle.LoadAsset <Mesh>("meshMinecraftPaladin");
            minecraftSwordMesh = mainAssetBundle.LoadAsset <Mesh>("meshMinecraftSword");
            #endregion

            //weird shit to get the lightning effect looking how i want it
            altLightningImpactFX = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/Effects/ImpactEffects/LightningStrikeImpact"), "PaladinLightningStrikeImpact", true);

            PaladinPlugin.Destroy(altLightningImpactFX.transform.Find("LightningRibbon").gameObject);

            foreach (ParticleSystemRenderer i in altLightningImpactFX.GetComponentsInChildren <ParticleSystemRenderer>())
            {
                if (i)
                {
                    i.material.SetColor("_TintColor", Color.yellow);
                }
            }

            altLightningImpactFX.AddComponent <NetworkIdentity>();

            EffectAPI.AddEffect(altLightningImpactFX);

            //clone mithrix's dash effect and resize it for my dash
            dashFX = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/Effects/BrotherDashEffect"), "PaladinDashEffect", true);
            dashFX.AddComponent <NetworkIdentity>();
            dashFX.transform.localScale *= 0.3f;

            EffectAPI.AddEffect(dashFX);

            InitCustomItems();
        }
コード例 #12
0
ファイル: WispSurvivor.cs プロジェクト: alltucki/WispMod
        private void RegisterNetworkedEffects()
        {
            //TOOD: Replace with custom effect
            spawnEffect = Resources.Load <GameObject>("prefabs/effects/CrocoSpawnEffect").InstantiateClone("WispSpawn", true);
            spawnEffect.AddComponent <NetworkIdentity>();

            //fireballProjectile = Assets.MainAssetBundle.LoadAsset<GameObject>("WispFire");
            fireballProjectile = Resources.Load <GameObject>("Prefabs/Projectiles/WispCannon").InstantiateClone("WispFireball", true);
            fireballProjectile.GetComponent <ProjectileController>().ghostPrefab.transform.Find("Particles").Find("FireSphere").transform.localScale = new Vector3(.4f, .4f, .4f);
            fireballProjectile.GetComponent <ProjectileDamage>().force = 0f;
            // 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.Generic;

            tetherPrefab = Assets.MainAssetBundle.LoadAsset <GameObject>("Tether");

            //burstPrefab = Assets.MainAssetBundle.LoadAsset<GameObject>("SmallExplosionEffect");
            burstPrefab    = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("prefabs/effects/WilloWispExplosion"), "Prefabs/Projectiles/burstPrefab", true, "C:\\Users\\test\\Documents\\ror2mods\\ExampleSurvivor\\ExampleSurvivor\\ExampleSurvivor\\ExampleSurvivor.cs", "RegisterCharacter", 155);
            burstSecondary = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("prefabs/effects/ShieldBreakEffect"), "Prefabs/Projectiles/burstPrefab", true, "C:\\Users\\test\\Documents\\ror2mods\\ExampleSurvivor\\ExampleSurvivor\\ExampleSurvivor\\ExampleSurvivor.cs", "RegisterCharacter", 155);

            //Scale the explosion sizes
            Vector3 burstPrimaryScale = new Vector3(.75f, .75f, .75f);

            burstPrefab.transform.Find("Flash").localScale          = burstPrimaryScale;
            burstPrefab.transform.Find("Flames, Tube").localScale   = burstPrimaryScale;
            burstPrefab.transform.Find("Flames, Radial").localScale = burstPrimaryScale;

            Vector3 burstSecondaryScale = new Vector3(2f, 2f, 2f);

            burstSecondary.transform.Find("Lightning").localScale = burstSecondaryScale;
            burstSecondary.transform.Find("Shards").localScale    = burstSecondaryScale;
            burstSecondary.transform.Find("Flash").localScale     = burstSecondaryScale;


            // register it for networking
            //fireballProjectile.AddComponent<NetworkIdentity>();
            if (fireballProjectile)
            {
                PrefabAPI.RegisterNetworkPrefab(fireballProjectile);
            }
            tetherPrefab.AddComponent <NetworkIdentity>();
            if (tetherPrefab)
            {
                PrefabAPI.RegisterNetworkPrefab(tetherPrefab);
            }
            burstPrefab.AddComponent <NetworkIdentity>();
            if (burstPrefab)
            {
                PrefabAPI.RegisterNetworkPrefab(burstPrefab);
            }
            burstSecondary.AddComponent <NetworkIdentity>();
            if (burstSecondary)
            {
                PrefabAPI.RegisterNetworkPrefab(burstSecondary);
            }

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

            //Do the same for the effects
            EffectAPI.AddEffect(spawnEffect);
            EffectAPI.AddEffect(burstPrefab);
            EffectAPI.AddEffect(burstSecondary);
        }
コード例 #13
0
ファイル: Effects.cs プロジェクト: Reinms/RoR2Modding
        private static GameObject CreateGenericTracer(String name, Boolean doBeam, Boolean lineFromStart)
        {
            var obj = new GameObject(name).InstantiateClone(name, false);

            var startTransform = new GameObject("StartTransform").transform;

            startTransform.parent        = obj.transform;
            startTransform.localPosition = Vector3.zero;
            startTransform.localRotation = Quaternion.identity;
            startTransform.localScale    = Vector3.one;

            var headTransform = new GameObject("HeadTransform").transform;

            headTransform.parent        = obj.transform;
            headTransform.localPosition = Vector3.zero;
            headTransform.localRotation = Quaternion.identity;
            headTransform.localScale    = Vector3.one;

            var tailTransform = new GameObject("TailTransform").transform;

            tailTransform.parent        = obj.transform;
            tailTransform.localPosition = Vector3.zero;
            tailTransform.localRotation = Quaternion.identity;
            tailTransform.localScale    = Vector3.one;


            var effectComp = obj.AddComponent <EffectComponent>();

            effectComp.effectIndex = EffectIndex.Invalid;
            effectComp.positionAtReferencedTransform = false;
            effectComp.parentToReferencedTransform   = false;
            effectComp.applyScale = false;
            effectComp.soundName  = "";


            var tracerComp = obj.AddComponent <Tracer>();

            tracerComp.startTransform = startTransform;
            tracerComp.beamDensity    = 10f;
            tracerComp.speed          = 300f;
            tracerComp.headTransform  = headTransform;
            tracerComp.tailTransform  = tailTransform;
            tracerComp.length         = 3f;
            tracerComp.reverse        = false;

            if (doBeam)
            {
                var beamObject = new GameObject("BeamObject").transform;
                beamObject.parent        = obj.transform.parent;
                beamObject.localPosition = Vector3.zero;
                beamObject.localRotation = Quaternion.identity;
                beamObject.localScale    = Vector3.one;

                beamObject.gameObject.AddComponent <ParticleSystem>();

                tracerComp.beamObject = beamObject.gameObject;
            }


            var lineRender = obj.AddComponent <LineRenderer>();

            var beamPoints = obj.AddComponent <BeamPointsFromTransforms>();
            var transforms = beamPoints.GetFieldValue <Transform[]>("pointTransforms");

            Array.Resize <Transform>(ref transforms, 2);
            transforms[0] = (lineFromStart ? startTransform : tailTransform);
            transforms[1] = headTransform;

            var vfx = obj.AddComponent <VFXAttributes>();

            vfx.vfxPriority  = VFXAttributes.VFXPriority.Always;
            vfx.vfxIntensity = VFXAttributes.VFXIntensity.Low;

            EffectAPI.AddEffect(obj);

            return(obj);
        }