private void applyWind(Level level)
        {
            if (Settings.WindEverywhere != 0)
            {
                if (!snowBackdropAddedByEVM)
                {
                    // add the styleground / backdrop used in Golden Ridge to make wind actually visible.
                    // ExtendedVariantWindSnowFG will hide itself if a vanilla backdrop supporting wind is already present or appears.
                    level.Foreground.Backdrops.Add(new ExtendedVariantWindSnowFG()
                    {
                        Alpha = 0f
                    });
                    snowBackdropAddedByEVM = true;
                }

                // also switch the audio ambience so that wind can actually be heard too
                // (that's done by switching to the ch4 audio ambience. yep)
                Audio.SetAmbience("event:/env/amb/04_main", true);

                WindController.Patterns selectedPattern;
                if (Settings.WindEverywhere == AvailableWindPatterns.Length + 1)
                {
                    // pick up random wind
                    selectedPattern = AvailableWindPatterns[randomGenerator.Next(AvailableWindPatterns.Length)];
                }
                else
                {
                    // pick up the chosen wind pattern
                    selectedPattern = AvailableWindPatterns[Settings.WindEverywhere - 1];
                }

                // and apply it; this is basically what Wind Trigger does
                WindController windController = level.Entities.FindFirst <WindController>();
                if (windController == null)
                {
                    windController = new WindController(selectedPattern);
                    windController.SetStartPattern();
                    level.Add(windController);
                    level.Entities.UpdateLists();
                }
                else
                {
                    windController.SetPattern(selectedPattern);
                }
            }
            else if (snowBackdropAddedByEVM)
            {
                // remove the backdrop
                level.Foreground.Backdrops.RemoveAll(backdrop => backdrop.GetType() == typeof(ExtendedVariantWindSnowFG));
                snowBackdropAddedByEVM = false;
            }
        }
Esempio n. 2
0
        public void WindAction(string parameter)
        {
            Module.BirdyHelper.BirdCaw();

            WindController.Patterns pattern = WindController.Patterns.Right;

            if (parameter.IndexOf("left", StringComparison.OrdinalIgnoreCase) >= 0)
            {
                pattern = WindController.Patterns.Left;
            }
            else if (parameter.IndexOf("right", StringComparison.OrdinalIgnoreCase) >= 0)
            {
                pattern = WindController.Patterns.Right;
            }
            else if (parameter.IndexOf("up", StringComparison.OrdinalIgnoreCase) >= 0)
            {
                pattern = WindController.Patterns.Up;
            }
            else if (parameter.IndexOf("down", StringComparison.OrdinalIgnoreCase) >= 0)
            {
                pattern = WindController.Patterns.Down;
            }

            if (!Settings.WindEnabled)
            {
                currentLevel.Foreground.Backdrops.Add(new CrowControlWindSnowFG()
                {
                    Alpha = 0f
                });
                Audio.SetAmbience("event:/env/amb/04_main", true);

                WindController controller = currentLevel.Entities.FindFirst <WindController>();

                if (controller == null)
                {
                    controller = new WindController(pattern);
                    controller.SetStartPattern();
                    currentLevel.Add(controller);
                }
                else
                {
                    controller.SetPattern(pattern);
                }

                Settings.WindEnabled = true;
            }
        }