Amount of ambient light decreases when going deeper, closest sub can be moved with IJKL

This commit is contained in:
Regalis
2016-10-11 18:23:25 +03:00
parent d21c6674ea
commit bbec3d64dc
2 changed files with 10 additions and 2 deletions

View File

@@ -807,7 +807,7 @@ namespace Barotrauma
return matchingPositions[Rand.Int(matchingPositions.Count, !useSyncedRand)].Position;
}
public void Update (float deltaTime)
public void Update(float deltaTime)
{
if (Submarine.MainSub != null)
{
@@ -849,6 +849,11 @@ namespace Barotrauma
public void DrawBack(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam, BackgroundCreatureManager backgroundSpriteManager = null)
{
float brightness = MathHelper.Clamp(50.0f + (cam.Position.Y - Size.Y) / 2000.0f, 10.0f, 40.0f);
float avgValue = (backgroundColor.R + backgroundColor.G + backgroundColor.G) / 3;
GameMain.LightManager.AmbientLight = new Color(backgroundColor * (brightness / avgValue), 1.0f);
graphics.Clear(backgroundColor);
if (renderer == null) return;

View File

@@ -95,6 +95,9 @@ namespace Barotrauma
#if DEBUG
if (GameMain.GameSession != null && GameMain.GameSession.Level != null && GameMain.GameSession.Submarine != null)
{
var closestSub = Submarine.GetClosest(cam.WorldViewCenter);
if (closestSub == null) closestSub = GameMain.GameSession.Submarine;
Vector2 targetMovement = Vector2.Zero;
if (PlayerInput.KeyDown(Keys.I)) targetMovement.Y += 1.0f;
if (PlayerInput.KeyDown(Keys.K)) targetMovement.Y -= 1.0f;
@@ -102,7 +105,7 @@ namespace Barotrauma
if (PlayerInput.KeyDown(Keys.L)) targetMovement.X += 1.0f;
if (targetMovement != Vector2.Zero)
GameMain.GameSession.Submarine.ApplyForce(targetMovement * GameMain.GameSession.Submarine.SubBody.Body.Mass * 100.0f);
closestSub.ApplyForce(targetMovement * closestSub.SubBody.Body.Mass * 100.0f);
}
#endif
if (GameMain.GameSession != null) GameMain.GameSession.Update((float)deltaTime);