Ejemplo n.º 1
0
        ////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Prefix
        /// </summary>
        /// <param name="__instance">NoteCutCoreEffectsSpawner instance</param>
        /// <param name="____noteCutParticlesEffect">NoteCutParticlesEffect instance</param>
        internal static void Postfix(ref NoteCutCoreEffectsSpawner __instance, ref NoteCutParticlesEffect ____noteCutParticlesEffect)
        {
            /// Cache effect instance
            m_NoteCutParticlesEffect = ____noteCutParticlesEffect;

            if (Config.GameTweaker.Enabled)
            {
                /// Apply
                SetRemoveCutParticles(Config.GameTweaker.RemoveAllCutParticles);
            }
        }
Ejemplo n.º 2
0
        internal static void Prefix(ref NoteCutParticlesEffect __instance, ref int sparkleParticlesCount, ref int explosionParticlesCount)
        {
            ParticleSystem[] sparklesPS;
            try
            {
                sparklesPS = (ParticleSystem[])__instance.GetField("_sparklesPS");
            }
            catch (NullReferenceException)
            {
                Plugin.log.Critical("Failed to get _sparklesPS field!");
                return;
            }

            ParticleSystem explosionPS;

            try
            {
                explosionPS = (ParticleSystem)__instance.GetField("_explosionPS");
            }
            catch (NullReferenceException)
            {
                Plugin.log.Critical("Failed to get _explosionPS field!");
                return;
            }

            float slashMultiplier     = Plugin.config.GetFloat("particles", "slash-particles") ?? 1f;
            float explosionMultiplier = Plugin.config.GetFloat("particles", "explosion-particles") ?? 1f;
            float lifetimeMultiplier  = Plugin.config.GetFloat("particles", "particle-lifetime") ?? 1f;

            float sparkles  = sparkleParticlesCount * slashMultiplier;
            float explosion = explosionParticlesCount * explosionMultiplier;

            sparkleParticlesCount   = Mathf.FloorToInt(sparkles);
            explosionParticlesCount = Mathf.FloorToInt(explosion);

            foreach (ParticleSystem ps in sparklesPS)
            {
                ParticleSystem.MainModule psMain = ps.main;

                psMain.maxParticles            = int.MaxValue;
                psMain.startLifetimeMultiplier = lifetimeMultiplier;
            }

            ParticleSystem.MainModule explosionMain = explosionPS.main;

            explosionMain.maxParticles            = int.MaxValue;
            explosionMain.startLifetimeMultiplier = lifetimeMultiplier;
        }
Ejemplo n.º 3
0
        static void Prefix(ref NoteCutParticlesEffect __instance, ref int sparkleParticlesCount, ref int explosionParticlesCount)
        {
            float slashMulti = Plugin.SlashParticleMultiplier;
            float exploMulti = Plugin.ExplosionParticleMultiplier;

            ParticleSystem[] slashPS = (ParticleSystem[])__instance.GetField("_sparklesPS");
            foreach (ParticleSystem ps in slashPS)
            {
                ParticleSystem.MainModule main = ps.main;
                main.maxParticles = 150 * Mathf.FloorToInt(slashMulti * 2f);
            }

            sparkleParticlesCount = 150 * Mathf.FloorToInt(slashMulti);

            ParticleSystem.MainModule exploPS = ((ParticleSystem)__instance.GetField("_explosionPS")).main;

            explosionParticlesCount = 150 * Mathf.FloorToInt(exploMulti);
            exploPS.maxParticles    = 150 * Mathf.FloorToInt(exploMulti * 2f);
        }
Ejemplo n.º 4
0
        internal static void Prefix(ref NoteCutParticlesEffect __instance, ref Color32 color, ref int sparkleParticlesCount, ref int explosionParticlesCount, ref float lifetimeMultiplier)
        {
            ParticleSystem explosionPS = Plugin.GetExplosionPS(__instance);

            ParticleSystem[] sparklesPSAry = Plugin.GetSparklesPS(__instance);

            sparkleParticlesCount   = Mathf.FloorToInt(sparkleParticlesCount * Plugin.SlashParticleMultiplier);
            explosionParticlesCount = Mathf.FloorToInt(explosionParticlesCount * Plugin.ExplosionParticleMultiplier);
            lifetimeMultiplier     *= Plugin.SlashParticleLifetimeMultiplier;
            if (Plugin.RainbowParticles)
            {
                color = UnityEngine.Random.ColorHSV(0, 1, 1, 1, 1, 1, 1, 1);
            }
            for (int i = 0; i < sparklesPSAry.Length; i++)
            {
                ParticleSystem.MainModule slashMain = sparklesPSAry[i].main;
                slashMain.maxParticles = int.MaxValue;
            }
            ParticleSystem.MainModule explosionMain = explosionPS.main;
            explosionMain.maxParticles            = int.MaxValue;
            explosionMain.startLifetimeMultiplier = Plugin.ExplosionParticleLifetimeMultiplier;
        }
        static void Prefix(ref NoteCutParticlesEffect __instance, ref int sparkleParticlesCount, ref int explosionParticlesCount)
        {
            if (!ChromaSparksConfig.ParticleManipulationEnabled)
            {
                return;
            }

            sparkleParticlesCount   = Mathf.FloorToInt(150 * ChromaSparksConfig.SlashParticlesMult);
            explosionParticlesCount = Mathf.FloorToInt(150 * ChromaSparksConfig.ExplosionParticlesMult);

            ParticleSystem[] sparklesPS = __instance.GetField <ParticleSystem[]>("_sparklesPS");

            foreach (ParticleSystem sparklesSubPS in sparklesPS)
            {
                ParticleSystem.MainModule sparkles = sparklesSubPS.main;
                if (ChromaSparksConfig.SlashParticlesMult != 1)
                {
                    sparkles.maxParticles = Mathf.FloorToInt(150 * Mathf.Max(ChromaSparksConfig.ParticlesGlobalMaxMult, ChromaSparksConfig.SlashParticlesMult));
                }
                if (ChromaSparksConfig.SlashParticlesTimeScale != 1)
                {
                    sparkles.simulationSpeed = ChromaSparksConfig.SlashParticlesTimeScale;
                }
                if (ChromaSparksConfig.SlashParticlesLifeMult != 1)
                {
                    sparkles.duration = 2f * ChromaSparksConfig.SlashParticlesLifeMult;
                    sparkles.startLifetimeMultiplier = 0.99f * ChromaSparksConfig.SlashParticlesLifeMult;
                }
                if (ChromaSparksConfig.SlashParticlesSpeedMult != 1)
                {
                    sparkles.startSpeedMultiplier = 20 * ChromaSparksConfig.SlashParticlesSpeedMult;
                }
            }

            /*for (int i = 0; i < sparklesPS.Length; i++) {
             *  ParticleSystem sparklesSubPS = sparklesPS[i];
             *  ChromaLogger.Log(sparklesSubPS.name);
             *  ChromaLogger.Log("sparklesPS Amt : " + sparkleParticlesCount); // 150
             *  ChromaLogger.Log("sparklesPS max : " + sparklesSubPS.main.maxParticles); //1000
             *  ChromaLogger.Log("sparklesPS life : " + sparklesSubPS.main.duration); //2
             *  ChromaLogger.Log("sparklesPS lifetimeMult : " + sparklesSubPS.main.startLifetimeMultiplier); //0.99
             *  ChromaLogger.Log("sparklesPS speedMult : " + sparklesSubPS.main.startSpeedMultiplier); //20
             * }*/

            /*ParticleSystem sparklesPS = __instance.GetField<ParticleSystem>("_sparklesPS");
             *
             * ParticleSystem.MainModule sparkles = sparklesPS.main;
             * if (ChromaConfig.slashParticlesMult != 1) sparkles.maxParticles = 150 * Mathf.FloorToInt(Mathf.Max(ChromaConfig.particlesGlobalMaxMult, ChromaConfig.slashParticlesMult));
             * if (ChromaConfig.slashParticlesTimeScale != 1) sparkles.simulationSpeed = ChromaConfig.slashParticlesTimeScale;
             * if (ChromaConfig.slashParticlesLifeMult != 1) {
             *  sparkles.duration = 2f * ChromaConfig.slashParticlesLifeMult;
             *  sparkles.startLifetimeMultiplier = 1.2f * ChromaConfig.slashParticlesLifeMult;
             * }
             * if (ChromaConfig.slashParticlesSpeedMult != 1) sparkles.startSpeedMultiplier = 20 * ChromaConfig.slashParticlesSpeedMult;
             */

            ParticleSystem explosionPS = __instance.GetField <ParticleSystem>("_explosionPS");

            ParticleSystem.MainModule explosions = explosionPS.main;
            if (ChromaSparksConfig.ExplosionParticlesMult != 1)
            {
                explosions.maxParticles = Mathf.FloorToInt(150 * Mathf.Max(ChromaSparksConfig.ParticlesGlobalMaxMult, ChromaSparksConfig.ExplosionParticlesMult));
            }
            if (ChromaSparksConfig.ExplosionParticlesTimeScale != 1)
            {
                explosions.simulationSpeed = ChromaSparksConfig.ExplosionParticlesTimeScale;
            }
            if (ChromaSparksConfig.ExplosionParticlesLifeMult != 1)
            {
                explosions.duration = 2f * ChromaSparksConfig.ExplosionParticlesLifeMult;
                explosions.startLifetimeMultiplier = 0.8f * ChromaSparksConfig.ExplosionParticlesLifeMult;
            }
            if (ChromaSparksConfig.ExplosionParticlesSpeedMult != 1)
            {
                explosions.startSpeedMultiplier = 12 * ChromaSparksConfig.ExplosionParticlesSpeedMult;
            }


            //ChromaLogger.Log("sparklesPS Amt : " + sparkleParticlesCount); // 150
            //ChromaLogger.Log("sparklesPS max : " + sparklesPS.main.maxParticles); //1000
            //ChromaLogger.Log("sparklesPS life : " + sparklesPS.main.duration); //2
            //ChromaLogger.Log("sparklesPS lifetimeMult : " + sparklesPS.main.startLifetimeMultiplier); //1.2
            //ChromaLogger.Log("sparklesPS speedMult : " + sparklesPS.main.startSpeedMultiplier); //20

            //ChromaLogger.Log("explosionPS Amt : " + sparkleParticlesCount); // 150
            //ChromaLogger.Log("explosionPS max : " + explosionPS.main.maxParticles); //1000
            //ChromaLogger.Log("explosionPS life : " + explosionPS.main.duration); //2
            //ChromaLogger.Log("explosionPS lifetimeMult : " + explosionPS.main.startLifetimeMultiplier); //0.8
            //ChromaLogger.Log("explosionPS speedMult : " + explosionPS.main.startSpeedMultiplier); //12

            return;
        }
Ejemplo n.º 6
0
        public static bool Prefix(Vector3 pos, NoteController noteController, NoteCutInfo noteCutInfo, ref ColorManager ____colorManager, ref NoteCutParticlesEffect ____noteCutParticlesEffect, ref bool ____spawnScores, ref ScoreController ____scoreController, ref FlyingScoreSpawner ____flyingScoreSpawner, ref ShockwaveEffect ____shockwaveEffect, ref FlyingSpriteSpawner ____failFlyingSpriteSpawner, ref NoteDebrisSpawner ____noteDebrisSpawner)
        {
            if (!Plugin.active)
            {
                return(true);
            }

            if (noteCutInfo.allIsOK)
            {
                NoteData noteData = noteController.noteData;
                Color    color    = ____colorManager.ColorForNoteType(noteData.noteType).ColorWithAlpha(0.5f);
                ____noteCutParticlesEffect.SpawnParticles(pos, noteCutInfo.cutNormal, noteCutInfo.saberDir, color, 150, 50, Mathf.Clamp(noteData.timeToNextBasicNote, 0.4f, 1f), noteCutInfo.saberType);

                if (____spawnScores)
                {
                    int multiplierWithFever = ____scoreController.multiplierWithFever;
                    FlyingScoreSpawnerPatch.lastNoteRotation    = noteController.transform.rotation;
                    FlyingScoreSpawnerPatch.lastNoteRotationSet = true;
                    Vector3 pos2 = Quaternion.Inverse(FlyingSpriteSpawnerPatch.lastNoteRotation) * pos;
                    ____flyingScoreSpawner.SpawnFlyingScore(noteCutInfo, noteData.lineIndex, multiplierWithFever, pos2, new Color(0.8f, 0.8f, 0.8f));
                }
                Vector3 pos3 = pos;
                pos3.y = 0.01f;
                ____shockwaveEffect.SpawnShockwave(pos3);
            }
            else
            {
                FlyingSpriteSpawnerPatch.lastNoteRotation    = noteController.transform.rotation;
                FlyingSpriteSpawnerPatch.lastNoteRotationSet = true;
                Vector3 pos4 = Quaternion.Inverse(FlyingSpriteSpawnerPatch.lastNoteRotation) * pos;
                ____failFlyingSpriteSpawner.SpawnFlyingSprite(pos4);
            }
            ____noteDebrisSpawner.SpawnDebris(noteCutInfo, noteController);

            return(false);
        }