Very unfinished attempt at changing the coordinate system to work relative to the level and to move the sub instead of the whole level

This commit is contained in:
Regalis
2015-12-03 19:42:11 +02:00
parent 5bcdfa2b56
commit c064c5eb50
14 changed files with 278 additions and 269 deletions
+6 -6
View File
@@ -35,13 +35,13 @@ namespace Barotrauma
for (int i = 0; i < amount; i++)
{
Vector2 position = (randomWayPoint == null) ? Vector2.Zero : FarseerPhysics.ConvertUnits.ToSimUnits(randomWayPoint.Position + Level.Loaded.Position);
Vector2 position = (randomWayPoint == null) ? Vector2.Zero : FarseerPhysics.ConvertUnits.ToSimUnits(randomWayPoint.Position);
if (spawnDeep)
{
position.Y = FarseerPhysics.ConvertUnits.ToSimUnits(Level.Loaded.Position.Y);
}
//!!!!!!!!!!!!!!!!!!
//if (spawnDeep)
//{
// position.Y = FarseerPhysics.ConvertUnits.ToSimUnits(Level.Loaded.Position.Y);
//}
position.X += Rand.Range(-0.5f, 0.5f);
position.Y += Rand.Range(-0.5f, 0.5f);
@@ -31,7 +31,7 @@ namespace Barotrauma
{
Vector2 position = level.PositionsOfInterest[Rand.Int(level.PositionsOfInterest.Count, false)];
monster = Character.Create(monsterFile, ConvertUnits.ToSimUnits(position+level.Position));
monster = Character.Create(monsterFile, ConvertUnits.ToSimUnits(position));
}
public override void Update(float deltaTime)
@@ -47,8 +47,8 @@ namespace Barotrauma
Vector2 tryPos = level.PositionsOfInterest[Rand.Int(level.PositionsOfInterest.Count, false)];
if (Submarine.PickBody(
tryPos + level.Position,
tryPos + level.Position - Vector2.UnitY*level.Size.Y,
tryPos,
tryPos - Vector2.UnitY*level.Size.Y,
null, Physics.CollisionLevel) != null)
{
position = tryPos;
@@ -65,7 +65,7 @@ namespace Barotrauma
} while (tries < 10);
item = new Item(itemPrefab, position + level.Position);
item = new Item(itemPrefab, position);
item.MoveWithLevel = true;
item.body.FarseerBody.GravityScale = 0.5f;
//item.MoveWithLevel = true;