- host can respawn

- respawn info texts
- camera clamped to the the upper edge of the level
- fixed submarinebody being generated from all walls (and not just the ones belonging to that specific sub)
This commit is contained in:
Regalis
2016-06-23 18:23:20 +03:00
parent dc7956274c
commit 296c5a14ed
12 changed files with 204 additions and 74 deletions
+11 -10
View File
@@ -125,17 +125,11 @@ namespace Barotrauma
public void Translate(Vector2 amount)
{
position += amount;
}
public void UpdateTransform(bool interpolate = true, bool clampPos = false)
{
if (clampPos && Level.Loaded != null)
{
position.Y -= Math.Max(worldView.Y - Level.Loaded.Size.Y, 0.0f);
}
Vector2 interpolatedPosition = interpolate ? Physics.Interpolate(prevPosition, position) : position;
float interpolatedZoom = interpolate ? Physics.Interpolate(prevZoom, zoom) : zoom;
@@ -143,6 +137,13 @@ namespace Barotrauma
worldView.X = (int)(interpolatedPosition.X - worldView.Width / 2.0);
worldView.Y = (int)(interpolatedPosition.Y + worldView.Height / 2.0);
if (Level.Loaded != null && clampPos)
{
position.Y -= Math.Max(worldView.Y - Level.Loaded.Size.Y, 0.0f);
interpolatedPosition.Y -= Math.Max(worldView.Y - Level.Loaded.Size.Y, 0.0f);
}
transform = Matrix.CreateTranslation(
new Vector3(-interpolatedPosition.X, interpolatedPosition.Y, 0)) *
Matrix.CreateScale(new Vector3(interpolatedZoom, interpolatedZoom, 1)) *
@@ -216,14 +217,14 @@ namespace Barotrauma
Vector2 diff = (targetPos + offset) - position;
moveCam = diff / MoveSmoothness;
moveCam = diff / MoveSmoothness;
}
shakeTargetPosition = Rand.Vector(Shake);
shakePosition = Vector2.Lerp(shakePosition, shakeTargetPosition, 0.5f);
Shake = MathHelper.Lerp(Shake, 0.0f, deltaTime*2.0f);
Shake = MathHelper.Lerp(Shake, 0.0f, deltaTime * 2.0f);
Translate(moveCam+shakePosition);
Translate(moveCam + shakePosition);
}
public Vector2 Position