예제 #1
0
        private void Main_DoUpdate(On.Terraria.Main.orig_DoUpdate orig, Main self, GameTime gameTime)
        {
            GeneralHelpers.ClickHandling();
            GeneralHelpers.UpdateButtons();
            orig(self, gameTime);
            var aLoader = Ambience.Instance;

            Ambience.DoUpdate_Ambience();
            Ambience.UpdateVolume();
            if (Main.gameMenu)
            {
                return;
            }
            Player player = Main.player[Main.myPlayer]?.GetModPlayer <FootstepsPlayer>().player;

            // soundInstancer.Condition = player.ZoneSkyHeight;
            if (Main.hasFocus)
            {
                delta_lastPos_playerBottom = lastPlayerPositionOnGround - player.Bottom.Y;

                // Main.NewText(delta_lastPos_playerBottom);
                if (ModContent.GetInstance <AmbientConfigServer>().newSplashes)
                {
                    if (player.velocity.Y <= 0 || player.teleporting)
                    {
                        lastPlayerPositionOnGround = player.Bottom.Y;
                    }
                    // Main.NewText(player.fallStart - player.Bottom.Y);
                    if (delta_lastPos_playerBottom > -300)
                    {
                        Main.soundSplash[0] = Ambience.SplashNew;
                    }
                    else if (delta_lastPos_playerBottom <= -300)
                    {
                        Main.soundSplash[0] = GetSound($"{Ambience.AmbientPath}/environment/liquid/entity_splash_heavy");
                    }
                }
            }
            Ambience.ClampAll();
        }