コード例 #1
0
ファイル: CreateEffects.cs プロジェクト: Reinms/RoR2Modding
        private void AW_SecondaryExplosion()
        {
            var obj     = PrefabsCore.CreatePrefab("SecondaryExplosionEffect", false);
            var effComp = obj.AddComponent <EffectComponent>();

            effComp.positionAtReferencedTransform = false;
            effComp.parentToReferencedTransform   = false;
            effComp.applyScale = false;
            effComp.soundName  = null;

            var skin = obj.AddComponent <WispSkinnedEffect>();

            var vecScale = obj.AddComponent <EffectVectorScale>();

            vecScale.effectComp    = effComp;
            vecScale.applyX        = true;
            vecScale.applyY        = false;
            vecScale.applyZ        = true;
            vecScale.durationFrac  = 0f;
            vecScale.scaleOverTime = false;

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

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

            var timer = obj.AddComponent <DestroyOnTimer>();

            timer.duration = 1f;

            var sounds = obj.AddComponent <EffectSoundPlayer>();

            sounds.AddSound(new SoundEvent(0f, "Play_gravekeeper_attack2_shoot", 1f));


            var flash1     = EffectHelper.AddFlash(obj, skin, MaterialType.Tracer);
            var flash1Main = flash1.main;

            flash1Main.scalingMode = ParticleSystemScalingMode.Local;


            var pillar = EffectHelper.AddFlamePillar(obj, skin, MaterialType.FlamePillar, 1000f, 3f, 0.75f);


            if (!this.AW_lowPerf.Value)
            {
                var sparks    = EffectHelper.AddSparks(obj, skin, MaterialType.Tracer, 5000, 0.15f, 1.2f);
                var sparkMain = sparks.main;
                sparkMain.scalingMode  = ParticleSystemScalingMode.Shape;
                sparkMain.maxParticles = 10000;
                var sparkShape = sparks.shape;
                sparkShape.enabled   = true;
                sparkShape.shapeType = ParticleSystemShapeType.ConeVolume;
                sparkShape.angle     = 0f;
                sparkShape.radius    = 2f;
                sparkShape.length    = 1000f;
                sparkShape.rotation  = new Vector3(-90f, 0f, 0f);
            }



            var flashLines     = EffectHelper.AddFlashLines(obj, skin, MaterialType.Tracer, 10, 0.2f);
            var flashLinesMain = flashLines.main;

            flashLinesMain.scalingMode = ParticleSystemScalingMode.Shape;
            var flashLineShape = flashLines.shape;

            flashLineShape.enabled   = true;
            flashLineShape.shapeType = ParticleSystemShapeType.Cone;
            flashLineShape.radius    = 1f;
            flashLineShape.length    = 5f;
            flashLineShape.angle     = 30f;
            flashLineShape.rotation  = new Vector3(-90f, 0f, 0f);



            //var explosion = EffectHelper.AddExplosion( obj, skin, MaterialType.Explosion, 20, 0.3f, 5, 5f );
            //var explShape = explosion.shape;
            //explShape.enabled = true;
            //explShape.shapeType = ParticleSystemShapeType.Hemisphere;
            //explShape.radius = 0.5f;
            //explShape.rotation = new Vector3( -90f, 0f, 0f );

            if (!this.AW_lowPerf.Value)
            {
                var light = EffectHelper.AddLight(obj, skin, true, 20f, 100f);
                light.transform.localPosition += new Vector3(0f, 3f, 0f);
                EffectHelper.EditLightOverTime(light, 2f, AnimationCurve.EaseInOut(0f, 1f, 1f, 0f), AnimationCurve.EaseInOut(0f, 1f, 1f, 0f));
            }

            if (!this.AW_lowPerf.Value)
            {
                var distortion = EffectHelper.AddDistortion(obj, skin, MaterialType.Distortion, 8f, 0.3f, 0f);
            }

            AW_secondaryExplosion = obj;
            RegisterEffect(AW_secondaryExplosion);
        }
コード例 #2
0
ファイル: CreateEffects.cs プロジェクト: Reinms/RoR2Modding
        private void AW_PrimaryExplosionEffect()
        {
            var obj     = PrefabsCore.CreatePrefab("PrimaryExplosionEffect", false);
            var effComp = obj.AddComponent <EffectComponent>();

            effComp.positionAtReferencedTransform = false;
            effComp.parentToReferencedTransform   = false;
            effComp.applyScale = true;
            effComp.soundName  = "Play_item_use_meteor_impact";

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

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

            var skinner = obj.AddComponent <WispSkinnedEffect>();

            var flash = EffectHelper.AddFlash(obj, skinner, MaterialType.Tracer, 2f);

            var flashLines     = EffectHelper.AddFlashLines(obj, skinner, MaterialType.Tracer, 30, 0.05f, 0.05f, 1f);
            var flashLineShape = flashLines.shape;

            flashLineShape.enabled         = true;
            flashLineShape.shapeType       = ParticleSystemShapeType.Cone;
            flashLineShape.radius          = 0.01f;
            flashLineShape.length          = 1f;
            flashLineShape.angle           = 60f;
            flashLineShape.rotation        = new Vector3(-90f, 0f, 0f);
            flashLineShape.radiusThickness = 0.5f;

            if (!this.AW_lowPerf.Value)
            {
                var distortion     = EffectHelper.AddDistortion(obj, skinner, MaterialType.DistortionHeavy, 2f, 0.25f, 0f);
                var distortionEmis = distortion.emission;
                distortionEmis.enabled    = true;
                distortionEmis.burstCount = 1;
                distortionEmis.SetBurst(0, new ParticleSystem.Burst(0f, 1f, 1, 0.1f));
                var distortionSOL = distortion.sizeOverLifetime;
                distortionSOL.enabled = true;
                distortionSOL.size    = new ParticleSystem.MinMaxCurve(1f, AnimationCurve.Linear(0f, 0f, 1f, 1f));
            }

            var explosion = EffectHelper.AddExplosion(obj, skinner, MaterialType.Explosion, 15, 0.25f, 5f, 1f);
            var explMain  = explosion.main;

            explMain.gravityModifier = 0.5f;
            var explShape = explosion.shape;

            explShape.enabled   = true;
            explShape.shapeType = ParticleSystemShapeType.Cone;
            explShape.angle     = 60f;
            explShape.radius    = 0.25f;
            explShape.rotation  = new Vector3(-90f, 0f, 0f);

            if (!this.AW_lowPerf.Value)
            {
                var light = EffectHelper.AddLight(obj, skinner, true, 10f, 10f);
                light.transform.localPosition += new Vector3(0f, 0.5f, 0f);
                EffectHelper.EditLightOverTime(light, 0.5f, AnimationCurve.EaseInOut(0f, 1f, 1f, 0f), AnimationCurve.EaseInOut(0f, 1f, 1f, 0f));
            }



            AW_primaryExplosionEffect = obj;
            RegisterEffect(AW_primaryExplosionEffect);
        }
コード例 #3
0
        private void RW_CreateNewSecondaryExplosion()
        {
            var obj = new GameObject().ClonePrefab("SecondaryExplosion", false);

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

            effComp.positionAtReferencedTransform = false;
            effComp.parentToReferencedTransform   = false;
            effComp.applyScale = false;
            effComp.soundName  = "Play_item_use_meteor_impact";

            var skin = obj.AddComponent <WispSkinnedEffect>();

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

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

            var timer = obj.AddComponent <DestroyOnTimer>();

            timer.duration = 4f;


            var flash1 = EffectHelper.AddFlash(obj, skin, MaterialType.Tracer);


            var pillar = EffectHelper.AddFlamePillar(obj, skin, MaterialType.FlamePillar, 20f, 4f, 0.35f, 8);


            var sparks     = EffectHelper.AddSparks(obj, skin, MaterialType.Tracer, 100, 0.15f, 1.2f);
            var sparkShape = sparks.shape;

            sparkShape.enabled   = true;
            sparkShape.shapeType = ParticleSystemShapeType.ConeVolume;
            sparkShape.angle     = 0f;
            sparkShape.radius    = 3.5f;
            sparkShape.length    = 20f;
            sparkShape.rotation  = new Vector3(-90f, 0f, 0f);


            var flashLines     = EffectHelper.AddFlashLines(obj, skin, MaterialType.Tracer, 20, 0.2f);
            var flashLineShape = flashLines.shape;

            flashLineShape.enabled   = true;
            flashLineShape.shapeType = ParticleSystemShapeType.Cone;
            flashLineShape.radius    = 3.5f;
            flashLineShape.length    = 5f;
            flashLineShape.angle     = 30f;
            flashLineShape.rotation  = new Vector3(-90f, 0f, 0f);



            var explosion = EffectHelper.AddExplosion(obj, skin, MaterialType.Explosion, 40, 0.2f, 5, 8f);
            var explShape = explosion.shape;

            explShape.enabled   = true;
            explShape.shapeType = ParticleSystemShapeType.Hemisphere;
            explShape.radius    = 0.75f;
            explShape.rotation  = new Vector3(-90f, 0f, 0f);


            var light = EffectHelper.AddLight(obj, skin, true, 10f, 100f);

            light.transform.localPosition += new Vector3(0f, 3f, 0f);
            EffectHelper.EditLightOverTime(light, 2f, AnimationCurve.EaseInOut(0f, 1f, 1f, 0f), AnimationCurve.EaseInOut(0f, 1f, 1f, 0f));


            var distortion = EffectHelper.AddDistortion(obj, skin, MaterialType.DistortionHeavy, 12f, 0.35f, 0.1f);
            var distEmis   = distortion.emission;

            distEmis.burstCount = 1;
            distEmis.SetBurst(0, new ParticleSystem.Burst(0f, 1));



            secondaryExplosion = obj;
            RegisterEffect(secondaryExplosion);
        }