Files
CalamityModPublic/Backgrounds/AstralSurfaceBGStyle.cs
T
DominicKarma42 55e89c9b98 Replaced (hopefully) every magic number with a constant
Note: Does not include item rarities, and appears to shown nonexistant using directive movement in the commit. This does not really affect anything, however.
2020-05-30 17:56:36 -04:00

45 lines
1.5 KiB
C#

using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Backgrounds
{
public class AstralSurfaceBGStyle : ModSurfaceBgStyle
{
public override int ChooseFarTexture() => mod.GetBackgroundSlot("Backgrounds/AstralSurfaceFar");
public override int ChooseMiddleTexture() => mod.GetBackgroundSlot("Backgrounds/AstralSurfaceMiddle");
public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b)
{
scale *= 0.75f;
return mod.GetBackgroundSlot("Backgrounds/AstralSurfaceClose");
}
public override bool ChooseBgStyle() => !Main.gameMenu && Main.LocalPlayer.InAstral() && !Main.LocalPlayer.ZoneDesert && !Main.LocalPlayer.ZoneSnow;
public override void ModifyFarFades(float[] fades, float transitionSpeed)
{
//This just fades in the background and fades out other backgrounds.
for (int i = 0; i < fades.Length; i++)
{
if (i == Slot)
{
fades[i] += transitionSpeed;
if (fades[i] > 1f)
{
fades[i] = 1f;
}
}
else
{
fades[i] -= transitionSpeed;
if (fades[i] < 0f)
{
fades[i] = 0f;
}
}
}
}
}
}