Fixed background fish not being rendered, added scale parameter to bg fish and made them a little smaller and faster. Closes #362
This commit is contained in:
@@ -177,8 +177,12 @@ namespace Barotrauma
|
||||
drawPosition -= camOffset * (depth / MaxDepth) * 0.05f;
|
||||
}
|
||||
|
||||
prefab.Sprite.Draw(spriteBatch, new Vector2(drawPosition.X, -drawPosition.Y), Color.Lerp(Color.White, Color.DarkBlue, (depth/MaxDepth)*0.3f),
|
||||
rotation, 1.0f - (depth / MaxDepth) * 0.2f, velocity.X > 0.0f ? SpriteEffects.None : SpriteEffects.FlipHorizontally, (depth / MaxDepth));
|
||||
prefab.Sprite.Draw(spriteBatch,
|
||||
new Vector2(drawPosition.X, -drawPosition.Y),
|
||||
Color.Lerp(Color.White, Color.DarkBlue, (depth/MaxDepth)*0.3f),
|
||||
rotation, (1.0f - (depth / MaxDepth) * 0.2f) * prefab.Scale,
|
||||
velocity.X > 0.0f ? SpriteEffects.None : SpriteEffects.FlipHorizontally,
|
||||
(depth / MaxDepth));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ namespace Barotrauma
|
||||
{
|
||||
class BackgroundCreaturePrefab
|
||||
{
|
||||
|
||||
public readonly Sprite Sprite;
|
||||
|
||||
public readonly float Speed;
|
||||
@@ -18,6 +17,8 @@ namespace Barotrauma
|
||||
public readonly float SwarmRadius;
|
||||
|
||||
public readonly bool DisableRotation;
|
||||
|
||||
public readonly float Scale;
|
||||
|
||||
public BackgroundCreaturePrefab(XElement element)
|
||||
{
|
||||
@@ -34,6 +35,8 @@ namespace Barotrauma
|
||||
|
||||
DisableRotation = element.GetAttributeBool("disablerotation", false);
|
||||
|
||||
Scale = element.GetAttributeFloat("scale", 1.0f);
|
||||
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (subElement.Name.ToString().ToLowerInvariant() != "sprite") continue;
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawBack(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam, BackgroundCreatureManager backgroundCreatureManager = null)
|
||||
public void DrawBack(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam)
|
||||
{
|
||||
float brightness = MathHelper.Clamp(1.1f + (cam.Position.Y - Size.Y) / 100000.0f, 0.1f, 1.0f);
|
||||
GameMain.LightManager.AmbientLight = new Color(backgroundColor * brightness, 1.0f);
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<backgroundcreatures>
|
||||
<Fish1 speed ="100.0" wanderamount="5.0" wanderzamount="0.1" swarmmin="2" swarmmax="10" swarmradius="500">
|
||||
<Fish1 speed ="200.0" wanderamount="3.0" wanderzamount="0.1" swarmmin="2" swarmmax="10" swarmradius="500" scale="0.5">
|
||||
<Sprite texture="Content/BackgroundSprites/bgFish1.png" sourcerect="0,0,119,61"/>
|
||||
</Fish1>
|
||||
|
||||
<Fish2 speed="40.0" wanderamount="0.2" wanderzamount="0.1" swarmmin="1" swarmmax="3" swarmradius="300">
|
||||
<Fish2 speed="80.0" wanderamount="0.2" wanderzamount="0.1" swarmmin="1" swarmmax="3" swarmradius="300" scale="0.5">
|
||||
<Sprite texture="Content/BackgroundSprites/bgFish1.png" sourcerect="1,65,113,64"/>
|
||||
</Fish2>
|
||||
|
||||
<Fish3 speed="20.0" wanderamount="5.0" wanderzamount="0.1" swarmmin="3" swarmmax="6" swarmradius="300" disablerotation="true">
|
||||
<Fish3 speed="40.0" wanderamount="3.0" wanderzamount="0.1" swarmmin="3" swarmmax="6" swarmradius="300" disablerotation="true">
|
||||
<Sprite texture="Content/BackgroundSprites/bgFish1.png" sourcerect="135,0,117,70"/>
|
||||
</Fish3>
|
||||
|
||||
<Fish4 speed="200.0" wanderamount="5.0" wanderzamount="0.1" swarmmin="1" swarmmax="3" swarmradius="300">
|
||||
<Fish4 speed="200.0" wanderamount="3.0" wanderzamount="0.1" swarmmin="1" swarmmax="3" swarmradius="300" scale="0.5">
|
||||
<Sprite texture="Content/BackgroundSprites/bgFish1.png" sourcerect="117,70,139,64"/>
|
||||
</Fish4>
|
||||
|
||||
<Fish5 speed="40.0" wanderamount="0.1" wanderzamount="0.1" swarmmin="1" swarmmax="3" swarmradius="300">
|
||||
<Fish5 speed="80.0" wanderamount="0.1" wanderzamount="0.1" swarmmin="1" swarmmax="3" swarmradius="300" scale="0.5">
|
||||
<Sprite texture="Content/BackgroundSprites/bgFish1.png" sourcerect="0,130,159,50"/>
|
||||
</Fish5>
|
||||
</backgroundcreatures>
|
||||
Reference in New Issue
Block a user