v5.1.3: the upper border of the level is one continuous body instead of two separate bodies at the entrance and exit
This commit is contained in:
@@ -113,7 +113,7 @@ namespace Barotrauma
|
||||
private set;
|
||||
}
|
||||
|
||||
public Body[] ShaftBodies
|
||||
public Body ShaftBody
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
@@ -511,21 +511,17 @@ namespace Barotrauma
|
||||
cells.AddRange(wrappingWalls[side, i].Cells);
|
||||
}
|
||||
}
|
||||
|
||||
ShaftBody = BodyFactory.CreateEdge(GameMain.World,
|
||||
ConvertUnits.ToSimUnits(new Vector2(borders.X, 0)),
|
||||
ConvertUnits.ToSimUnits(new Vector2(borders.Right, 0)));
|
||||
|
||||
ShaftBody.SetTransform(ConvertUnits.ToSimUnits(new Vector2(0.0f, borders.Height)), 0.0f);
|
||||
|
||||
ShaftBody.BodyType = BodyType.Static;
|
||||
ShaftBody.CollisionCategories = Physics.CollisionLevel;
|
||||
|
||||
ShaftBodies = new Body[2];
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
ShaftBodies[i] = BodyFactory.CreateRectangle(GameMain.World, 200.0f, ConvertUnits.ToSimUnits(ShaftHeight), 5.0f);
|
||||
ShaftBodies[i].BodyType = BodyType.Static;
|
||||
ShaftBodies[i].CollisionCategories = Physics.CollisionLevel;
|
||||
|
||||
Vector2 shaftPos = (i == 0) ? startPosition : endPosition;
|
||||
shaftPos.Y = borders.Height + 150.0f;
|
||||
|
||||
ShaftBodies[i].SetTransform(ConvertUnits.ToSimUnits(shaftPos), 0.0f);
|
||||
bodies.Add(ShaftBodies[i]);
|
||||
}
|
||||
bodies.Add(ShaftBody);
|
||||
|
||||
foreach (VoronoiCell cell in cells)
|
||||
{
|
||||
|
||||
@@ -172,11 +172,10 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
//RuinGeneration.RuinGenerator.Draw(spriteBatch);
|
||||
}
|
||||
|
||||
|
||||
Vector2 pos = new Vector2(0.0f, -level.Size.Y);// level.EndPosition;
|
||||
Vector2 pos = new Vector2(0.0f, -level.Size.Y);
|
||||
|
||||
if (GameMain.GameScreen.Cam.WorldView.Y < -pos.Y - 1024) return;
|
||||
|
||||
@@ -184,20 +183,14 @@ namespace Barotrauma
|
||||
|
||||
int width = (int)(Math.Ceiling(GameMain.GameScreen.Cam.WorldView.Width / 1024 + 4.0f) * 1024);
|
||||
|
||||
GUI.DrawRectangle(spriteBatch,new Rectangle((int)(MathUtils.Round(pos.X, 1024)), (int)-GameMain.GameScreen.Cam.WorldView.Y, width, (int)(GameMain.GameScreen.Cam.WorldView.Y - level.Size.Y) + 30),Color.Black, true);
|
||||
GUI.DrawRectangle(spriteBatch,new Rectangle((int)(MathUtils.Round(pos.X, 1024)), (int)-GameMain.GameScreen.Cam.WorldView.Y, width, (int)(GameMain.GameScreen.Cam.WorldView.Y + pos.Y) - 30),Color.Black, true);
|
||||
spriteBatch.Draw(shaftTexture,
|
||||
new Rectangle((int)(MathUtils.Round(pos.X, 1024)), (int)pos.Y, width, 1024),
|
||||
new Rectangle(0, 0, width, 1024),
|
||||
new Rectangle((int)(MathUtils.Round(pos.X, 1024)), (int)pos.Y-1000, width, 1024),
|
||||
new Rectangle(0, 0, width, -1024),
|
||||
level.BackgroundColor, 0.0f,
|
||||
Vector2.Zero,
|
||||
SpriteEffects.None, 0.0f);
|
||||
|
||||
|
||||
|
||||
//background.DrawTiled(spriteBatch,
|
||||
// (backgroundPos.Y < 0) ? new Vector2(0.0f, -backgroundPos.Y) : Vector2.Zero,
|
||||
// new Vector2(GameMain.GraphicsWidth, 1024 - backgroundPos.Y),
|
||||
// Vector2.Zero, level.BackgroundColor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -58,8 +58,7 @@ namespace Barotrauma
|
||||
//Vector2 diff = targetPos - sub.Position;
|
||||
float targetSpeed = 10.0f;
|
||||
|
||||
Level.Loaded.ShaftBodies[0].Enabled = false;
|
||||
Level.Loaded.ShaftBodies[1].Enabled = false;
|
||||
Level.Loaded.ShaftBody.Enabled = false;
|
||||
|
||||
cam.TargetPos = Vector2.Zero;
|
||||
float timer = 0.0f;
|
||||
@@ -79,7 +78,7 @@ namespace Barotrauma
|
||||
cam.Zoom = Math.Max(0.2f, cam.Zoom - CoroutineManager.UnscaledDeltaTime * 0.1f);
|
||||
|
||||
Vector2 cameraPos = subs.First().Position + Submarine.MainSub.HiddenSubPosition;
|
||||
cameraPos.Y = Math.Min(cameraPos.Y, ConvertUnits.ToDisplayUnits(Level.Loaded.ShaftBodies[0].Position.Y) - cam.WorldView.Height/2.0f);
|
||||
cameraPos.Y = Math.Min(cameraPos.Y, ConvertUnits.ToDisplayUnits(Level.Loaded.ShaftBody.Position.Y) - cam.WorldView.Height/2.0f);
|
||||
|
||||
GUI.ScreenOverlayColor = Color.Lerp(Color.TransparentBlack, Color.Black, timer/duration);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user