Progress + prettier ice walls

This commit is contained in:
Regalis
2015-12-12 13:44:05 +02:00
parent 78bccca4af
commit 17e8a2171f
49 changed files with 479 additions and 273 deletions
+11 -11
View File
@@ -89,8 +89,8 @@ namespace Barotrauma
public override bool Contains(Vector2 position)
{
return (Submarine.RectContains(rect, position) &&
!Submarine.RectContains(new Rectangle(rect.X + 4, rect.Y - 4, rect.Width - 8, rect.Height - 8), position));
return (Submarine.RectContains(WorldRect, position) &&
!Submarine.RectContains(MathUtils.ExpandRect(WorldRect, -5), position));
}
private void FindHulls()
@@ -142,7 +142,7 @@ namespace Barotrauma
{
if (GameMain.DebugDraw)
{
Vector2 center = new Vector2(rect.X + rect.Width / 2.0f, -(rect.Y - rect.Width / 2.0f));
Vector2 center = new Vector2(WorldRect.X + rect.Width / 2.0f, -(WorldRect.Y - rect.Width / 2.0f));
GUI.DrawLine(sb, center, center + flowForce/10.0f, Color.Red);
GUI.DrawLine(sb, center + Vector2.One * 5.0f, center + lerpedFlowForce / 10.0f + Vector2.One * 5.0f, Color.Orange);
@@ -152,7 +152,7 @@ namespace Barotrauma
Color clr = (open == 0.0f) ? Color.Red : Color.Cyan;
GUI.DrawRectangle(sb, new Rectangle(rect.X, -rect.Y, rect.Width, rect.Height), clr*0.5f, true);
GUI.DrawRectangle(sb, new Rectangle(WorldRect.X, -WorldRect.Y, rect.Width, rect.Height), clr * 0.5f, true);
if (isHorizontal)
{
@@ -160,11 +160,11 @@ namespace Barotrauma
{
if (linkedTo[i].Rect.Center.X > rect.Center.X)
{
GUI.DrawRectangle(sb, new Rectangle(rect.Right, -rect.Y, 10, rect.Height), Color.Green * 0.3f, true);
GUI.DrawRectangle(sb, new Rectangle(WorldRect.Right, -WorldRect.Y, 10, rect.Height), Color.Green * 0.3f, true);
}
else
{
GUI.DrawRectangle(sb, new Rectangle(rect.X - 10, -rect.Y, 10, rect.Height), Color.Green * 0.3f, true);
GUI.DrawRectangle(sb, new Rectangle(WorldRect.X - 10, -WorldRect.Y, 10, rect.Height), Color.Green * 0.3f, true);
}
}
}
@@ -172,13 +172,13 @@ namespace Barotrauma
{
for (int i = 0; i < linkedTo.Count; i++)
{
if (linkedTo[i].Rect.Y - linkedTo[i].Rect.Height/2.0f > rect.Y)
if (linkedTo[i].Rect.Y - linkedTo[i].Rect.Height / 2.0f > WorldRect.Y)
{
GUI.DrawRectangle(sb, new Rectangle(rect.X, -rect.Y - 10, rect.Width, 10), Color.Green * 0.3f, true);
GUI.DrawRectangle(sb, new Rectangle(WorldRect.X, -WorldRect.Y - 10, rect.Width, 10), Color.Green * 0.3f, true);
}
else
{
GUI.DrawRectangle(sb, new Rectangle(rect.X, -rect.Y + rect.Height, rect.Width, 10), Color.Green * 0.3f, true);
GUI.DrawRectangle(sb, new Rectangle(WorldRect.X, -WorldRect.Y + rect.Height, rect.Width, 10), Color.Green * 0.3f, true);
}
}
}
@@ -186,7 +186,7 @@ namespace Barotrauma
if (isSelected)
{
GUI.DrawRectangle(sb,
new Vector2(rect.X - 5, -rect.Y - 5),
new Vector2(WorldRect.X - 5, -WorldRect.Y - 5),
new Vector2(rect.Width + 10, rect.Height + 10),
Color.Red);
}
@@ -200,7 +200,7 @@ namespace Barotrauma
int index = (int)Math.Floor(flowForce.Length() / 100.0f);
index = Math.Min(index,2);
soundIndex = SoundPlayer.flowSounds[index].Loop(soundIndex, soundVolume, Position, 2000.0f);
soundIndex = SoundPlayer.flowSounds[index].Loop(soundIndex, soundVolume, WorldPosition, 2000.0f);
flowForce = Vector2.Zero;
lerpedFlowForce = Vector2.Lerp(lerpedFlowForce, flowForce, 0.05f);
+22 -19
View File
@@ -156,7 +156,7 @@ namespace Barotrauma
surface = rect.Y - rect.Height;
aiTarget = new AITarget(this);
aiTarget.SightRange = (rect.Width + rect.Height)*10.0f;
aiTarget.SightRange = (rect.Width + rect.Height)*5.0f;
hullList.Add(this);
@@ -170,8 +170,8 @@ namespace Barotrauma
public override bool Contains(Vector2 position)
{
return (Submarine.RectContains(rect, position) &&
!Submarine.RectContains(new Rectangle(rect.X + 8, rect.Y - 8, rect.Width - 16, rect.Height - 16), position));
return (Submarine.RectContains(WorldRect, position) &&
!Submarine.RectContains(MathUtils.ExpandRect(WorldRect, -8), position));
}
public int GetWaveIndex(Vector2 position)
@@ -353,25 +353,28 @@ namespace Barotrauma
{
if (!editing && !GameMain.DebugDraw) return;
GUI.DrawRectangle(spriteBatch,
new Vector2(rect.X, -rect.Y),
new Vector2(rect.Width, rect.Height),
isHighlighted ? Color.Green : Color.Blue);
Rectangle drawRect =
Submarine == null ? rect : new Rectangle((int)(Submarine.DrawPosition.X + rect.X), (int)(Submarine.DrawPosition.Y + rect.Y), rect.Width, rect.Height);
GUI.DrawRectangle(spriteBatch,
new Rectangle(rect.X, -rect.Y, rect.Width, rect.Height),
new Vector2(drawRect.X, -drawRect.Y),
new Vector2(rect.Width, rect.Height),
Color.Blue);
GUI.DrawRectangle(spriteBatch,
new Rectangle(drawRect.X, -drawRect.Y, rect.Width, rect.Height),
Color.Red*((100.0f-OxygenPercentage)/400.0f), true);
spriteBatch.DrawString(GUI.Font, "Pressure: " + ((int)pressure - rect.Y).ToString() +
" - Oxygen: "+((int)OxygenPercentage), new Vector2(rect.X+10, -rect.Y+10), Color.Black);
spriteBatch.DrawString(GUI.Font, volume +" / "+ FullVolume, new Vector2(rect.X+10, -rect.Y+30), Color.Black);
" - Oxygen: " + ((int)OxygenPercentage), new Vector2(drawRect.X + 10, -drawRect.Y + 10), Color.Black);
spriteBatch.DrawString(GUI.Font, volume + " / " + FullVolume, new Vector2(drawRect.X + 10, -drawRect.Y + 30), Color.Black);
if (isSelected && editing)
if ((isSelected || isHighlighted) && editing)
{
GUI.DrawRectangle(spriteBatch,
new Vector2(rect.X - 5, -rect.Y - 5),
new Vector2(rect.Width + 10, rect.Height + 10),
Color.Red);
new Vector2(drawRect.X + 5, -drawRect.Y + 5),
new Vector2(rect.Width - 10, rect.Height - 10),
isHighlighted ? Color.LightBlue*0.5f : Color.Red*0.5f, true);
}
}
@@ -380,13 +383,13 @@ namespace Barotrauma
if (renderer.PositionInBuffer > renderer.vertices.Length - 6) return;
//calculate where the surface should be based on the water volume
float top = rect.Y+Submarine.Position.Y;
float top = rect.Y+Submarine.DrawPosition.Y;
float bottom = top - rect.Height;
float surfaceY = bottom + Volume / rect.Width;
//interpolate the position of the rendered surface towards the "target surface"
surface = surface + ((surfaceY - Submarine.Position.Y) - surface) / 10.0f;
float drawSurface = surface + Submarine.Position.Y;
surface = surface + ((surfaceY - Submarine.DrawPosition.Y) - surface) / 10.0f;
float drawSurface = surface + Submarine.DrawPosition.Y;
Matrix transform = cam.Transform * Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
@@ -407,7 +410,7 @@ namespace Barotrauma
Vector2[] uvCoords = new Vector2[4];
for (int i = 0; i < 4; i++ )
{
corners[i] += new Vector3(Submarine.Loaded.Position, 0.0f);
corners[i] += new Vector3(Submarine.DrawPosition, 0.0f);
uvCoords[i] = Vector2.Transform(new Vector2(corners[i].X, -corners[i].Y), transform);
}
@@ -424,7 +427,7 @@ namespace Barotrauma
return;
}
float x = rect.X+Submarine.Position.X;
float x = rect.X + Submarine.DrawPosition.X;
int start = (int)Math.Floor((cam.WorldView.X - x) / WaveWidth);
start = Math.Max(start, 0);
+161 -13
View File
@@ -6,6 +6,7 @@ using Lidgren.Network;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics;
using Voronoi2;
@@ -324,7 +325,12 @@ namespace Barotrauma
wrappingWalls[side, i] = new WrappingWall(pathCells, cells, borders.Height * 0.5f,
(side == 0 ? -1 : 1) * (i == 0 ? 1 : 2));
wrappingWalls[side, i].Vertices = GeneratePolygons(wrappingWalls[side, i].Cells, new List<VoronoiCell>());
wrappingWalls[side, i].Vertices = GeneratePolygons(wrappingWalls[side, i].Cells, new List<VoronoiCell>(), false);
//wrappingWalls[side, i].Cells[0].edges[1].isSolid = false;
//wrappingWalls[side, i].Cells[0].edges[3].isSolid = false;
//wrappingWalls[side, i].Cells[wrappingWalls[side, i].Cells.Count-1].edges[1].isSolid = false;
//wrappingWalls[side, i].Cells[wrappingWalls[side, i].Cells.Count - 1].edges[3].isSolid = false;
}
}
@@ -616,7 +622,7 @@ namespace Barotrauma
}
private VertexPositionTexture[] GeneratePolygons(List<VoronoiCell> cells, List<VoronoiCell> emptyCells)
private VertexPositionTexture[] GeneratePolygons(List<VoronoiCell> cells, List<VoronoiCell> emptyCells, bool setSolid=true)
{
List<VertexPositionTexture> verticeList = new List<VertexPositionTexture>();
//bodies = new List<Body>();
@@ -639,7 +645,7 @@ namespace Barotrauma
VoronoiCell adjacentCell = ge.AdjacentCell(cell);
if (adjacentCell!=null && cells.Contains(adjacentCell)) continue;
ge.isSolid = true;
if (setSolid) ge.isSolid = true;
if (!bodyPoints.Contains(ge.point1)) bodyPoints.Add(ge.point1);
if (!bodyPoints.Contains(ge.point2)) bodyPoints.Add(ge.point2);
@@ -651,15 +657,14 @@ namespace Barotrauma
continue;
}
var triangles = MathUtils.TriangulateConvexHull(tempVertices, cell.Center);
for (int i = 0; i < triangles.Count; i++)
{
foreach (Vector2 vertex in triangles[i])
{
verticeList.Add(new VertexPositionTexture(new Vector3(vertex, 0.0f), vertex/1000.0f));
}
}
//var triangles = MathUtils.TriangulateConvexHull(tempVertices, cell.Center);
//for (int i = 0; i < triangles.Count; i++)
//{
// foreach (Vector2 vertex in triangles[i])
// {
// verticeList.Add(new VertexPositionTexture(new Vector3(vertex, 0.0f), vertex/1000.0f));
// }
//}
if (bodyPoints.Count < 2) continue;
@@ -679,7 +684,7 @@ namespace Barotrauma
bodyPoints[i] = ConvertUnits.ToSimUnits(bodyPoints[i]);
}
triangles = MathUtils.TriangulateConvexHull(bodyPoints, cell.Center);
var triangles = MathUtils.TriangulateConvexHull(bodyPoints, cell.Center);
Body edgeBody = new Body(GameMain.World);
@@ -701,9 +706,152 @@ namespace Barotrauma
bodies.Add(edgeBody);
}
verticeList = GenerateWallShapes(cells);
return verticeList.ToArray();
}
private List<VertexPositionTexture> GenerateWallShapes(List<VoronoiCell> cells)
{
float wallThickness = 500.0f;
List<VertexPositionTexture> verticeList = new List<VertexPositionTexture>();
foreach (VoronoiCell cell in cells)
{
if (cell.body == null) continue;
foreach (GraphEdge edge in cell.edges)
{
if (edge.cell1 != null && edge.cell1.body == null) edge.cell1 = null;
if (edge.cell2 != null && edge.cell2.body == null) edge.cell2 = null;
//CompareCCW compare = new CompareCCW(cell.Center);
//if (compare.Compare(edge.point1, edge.point2) == -1)
//{
// var temp = edge.point1;
// edge.point1 = edge.point2;
// edge.point2 = temp;
//}
}
}
foreach (VoronoiCell cell in cells)
{
if (cell.body == null) continue;
foreach (GraphEdge edge in cell.edges)
{
if (!edge.isSolid) continue;
GraphEdge leftEdge = null, rightEdge = null;
foreach (GraphEdge edge2 in cell.edges)
{
if (edge == edge2) continue;
if (edge.point1 == edge2.point1 ||
edge.point1 == edge2.point2)
{
leftEdge = edge2;
}
else if(edge.point2 == edge2.point2 || edge.point2 == edge2.point1)
{
rightEdge = edge2;
}
}
Vector2 leftNormal = Vector2.Zero, rightNormal = Vector2.Zero;
if (leftEdge == null)
{
leftNormal = GetEdgeNormal(edge, cell);
}
else
{
leftNormal = (leftEdge.isSolid) ?
Vector2.Normalize(GetEdgeNormal(leftEdge) + GetEdgeNormal(edge, cell)) :
Vector2.Normalize(leftEdge.Center - edge.point1);
}
if (rightEdge == null)
{
rightNormal = GetEdgeNormal(edge, cell);
}
else
{
rightNormal = (rightEdge.isSolid) ?
Vector2.Normalize(GetEdgeNormal(rightEdge) + GetEdgeNormal(edge, cell)) :
Vector2.Normalize(rightEdge.Center - edge.point2);
}
for (int i = 0; i < 2; i++)
{
Vector2[] verts = new Vector2[3];
VertexPositionTexture[] vertPos = new VertexPositionTexture[3];
if (i==0)
{
verts[0] = edge.point1;
verts[1] = edge.point2;
verts[2] = edge.point1 + leftNormal * wallThickness;
vertPos[0] = new VertexPositionTexture(new Vector3(verts[0], 0.0f), Vector2.Zero);
vertPos[1] = new VertexPositionTexture(new Vector3(verts[1], 0.0f), Vector2.UnitX);
vertPos[2] = new VertexPositionTexture(new Vector3(verts[2], 0.0f), new Vector2(0, 0.5f));
}
else
{
verts[0] = edge.point1 + leftNormal * wallThickness;
verts[1] = edge.point2;
verts[2] = edge.point2 + rightNormal * wallThickness;
vertPos[0] = new VertexPositionTexture(new Vector3(verts[0], 0.0f), new Vector2(0.0f, 0.5f));
vertPos[1] = new VertexPositionTexture(new Vector3(verts[1], 0.0f), Vector2.UnitX);
vertPos[2] = new VertexPositionTexture(new Vector3(verts[2], 0.0f), new Vector2(1.0f, 0.5f));
}
var comparer = new CompareCCW((verts[0] + verts[1] + verts[2]) / 3.0f);
Array.Sort(verts, vertPos, comparer);
for (int j = 0; j<3; j++)
{
verticeList.Add(vertPos[j]);
}
}
}
}
return verticeList;
}
private Vector2 GetEdgeNormal(GraphEdge edge, VoronoiCell cell = null)
{
if (cell == null) cell = edge.AdjacentCell(null);
if (cell == null) return Vector2.UnitX;
CompareCCW compare = new CompareCCW(cell.Center);
if (compare.Compare(edge.point1, edge.point2) == -1)
{
var temp = edge.point1;
edge.point1 = edge.point2;
edge.point2 = temp;
}
Vector2 normal = Vector2.Zero;
normal = Vector2.Normalize(edge.point2 - edge.point1);
Vector2 diffToCell = Vector2.Normalize(cell.Center - edge.point2);
normal = new Vector2(-normal.Y, normal.X);
if (Vector2.Dot(normal, diffToCell) < 0)
{
normal = -normal;
}
return normal;
}
//public void SetPosition(Vector2 pos)
//{
// Vector2 amount = pos - Position;
@@ -27,7 +27,7 @@ namespace Barotrauma
basicEffect.VertexColorEnabled = false;
basicEffect.TextureEnabled = true;
basicEffect.Texture = TextureLoader.FromFile("Content/Map/iceSurface.png");
basicEffect.Texture = TextureLoader.FromFile("Content/Map/iceWall.png");
}
this.level = level;
@@ -73,12 +73,12 @@ namespace Barotrauma
{
for (int i = 0; i < 2; i++)
{
basicEffect.World = Matrix.CreateTranslation(
new Vector3(-Submarine.Loaded.Position + level.WrappingWalls[side, i].Offset, 0.0f)) *
cam.ShaderTransform *
Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
// basicEffect.World = Matrix.CreateTranslation(
// new Vector3(-Submarine.Loaded.Position + level.WrappingWalls[side, i].Offset, 0.0f)) *
// cam.ShaderTransform *
// Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
basicEffect.CurrentTechnique.Passes[0].Apply();
// basicEffect.CurrentTechnique.Passes[0].Apply();
graphicsDevice.DrawUserPrimitives(
PrimitiveType.TriangleList,
@@ -180,6 +180,11 @@ namespace Voronoi2
public bool isSolid;
public Vector2 Center
{
get { return (point1 + point2) / 2.0f; }
}
public VoronoiCell AdjacentCell(VoronoiCell cell)
{
if (cell1==cell)
@@ -95,8 +95,15 @@ namespace Barotrauma
vertices[3] = vertices[0] + Vector2.UnitY * wallSectionSize.Y;
VoronoiCell wallCell = new VoronoiCell(vertices);
wallCell.edges[0].cell1 = wallCell;
wallCell.edges[1].cell1 = wallCell;
wallCell.edges[2].cell1 = wallCell;
wallCell.edges[3].cell1 = wallCell;
wallCell.edges[0].isSolid = true;
wallCell.edges[2].isSolid = true;
if (i > 1)
{
wallCell.edges[1].cell2 = cells[i - 2];
+10 -4
View File
@@ -249,7 +249,7 @@ namespace Barotrauma.Lights
if (!Enabled) return;
CachedShadow cachedShadow = null;
if (cachedShadows.TryGetValue(light, out cachedShadow))
if (cachedShadows.TryGetValue(light, out cachedShadow) && false)
{
if (light.Position == cachedShadow.LightPos ||
Vector2.DistanceSquared(light.WorldPosition, cachedShadow.LightPos) < 1.0f)
@@ -269,9 +269,15 @@ namespace Barotrauma.Lights
}
else
{
CalculateShadowVertices(light.Position, los);
cachedShadow = new CachedShadow(shadowVertices, penumbraVertices, light.WorldPosition);
cachedShadows.Add(light, cachedShadow);
Vector2 lightPos = light.WorldPosition;
if (light.Submarine!=null && parentEntity != null && parentEntity.Submarine == light.Submarine)
{
lightPos = light.Position;
}
CalculateShadowVertices(lightPos, los);
// cachedShadow = new CachedShadow(shadowVertices, penumbraVertices, light.WorldPosition);
// cachedShadows.Add(light, cachedShadow);
}
DrawShadows(graphicsDevice, cam, transform, los);
+1 -1
View File
@@ -128,7 +128,7 @@ namespace Barotrauma.Lights
//draw the light shape
//where Alpha is 0, nothing will be written
spriteBatch.Begin(SpriteSortMode.Deferred, CustomBlendStates.MultiplyWithAlpha, null, null, null, null, Matrix.CreateTranslation(new Vector3(Submarine.Loaded.DrawPosition.X, -Submarine.Loaded.DrawPosition.Y, 0.0f)) * cam.Transform);
spriteBatch.Begin(SpriteSortMode.Deferred, CustomBlendStates.MultiplyWithAlpha, null, null, null, null, cam.Transform);
light.Draw(spriteBatch);
spriteBatch.End();
}
+1 -1
View File
@@ -101,7 +101,7 @@ namespace Barotrauma.Lights
{
Vector2 center = new Vector2(LightTexture.Width / 2, LightTexture.Height / 2);
float scale = range / (lightTexture.Width / 2.0f);
spriteBatch.Draw(lightTexture, new Vector2(Position.X, -Position.Y), null, color, 0, center, scale, SpriteEffects.None, 1);
spriteBatch.Draw(lightTexture, new Vector2(WorldPosition.X, -WorldPosition.Y), null, color, 0, center, scale, SpriteEffects.None, 1);
}
public void Remove()
+1 -1
View File
@@ -154,7 +154,7 @@ namespace Barotrauma
public virtual bool Contains(Vector2 position)
{
return (Submarine.RectContains(rect, position));
return (Submarine.RectContains(WorldRect, position));
}
protected void InsertToList()
+1 -1
View File
@@ -431,7 +431,7 @@ namespace Barotrauma
if (Submarine.Loaded != null && Submarine.Loaded.GodMode) return new AttackResult(0.0f, 0.0f);
if (!prefab.HasBody || prefab.IsPlatform) return new AttackResult(0.0f, 0.0f);
Vector2 transformedPos = ConvertUnits.ToDisplayUnits(position);
Vector2 transformedPos = position;
if (Submarine != null) transformedPos -= Submarine.Position;
int i = FindSectionIndex(transformedPos);
+2 -2
View File
@@ -101,7 +101,7 @@ namespace Barotrauma
public override Vector2 Position
{
get { return subBody.Position - HiddenSubPosition; }
get { return subBody==null ? Vector2.Zero : subBody.Position - HiddenSubPosition; }
}
public new Vector2 DrawPosition
@@ -616,7 +616,6 @@ namespace Barotrauma
XDocument doc = OpenDoc(filePath);
if (doc == null) return;
subBody = new SubmarineBody(this);
foreach (XElement element in doc.Root.Elements())
{
@@ -650,6 +649,7 @@ namespace Barotrauma
}
subBody = new SubmarineBody(this);
subBody.SetPosition(HiddenSubPosition);
loaded = this;
+4 -3
View File
@@ -225,7 +225,7 @@ namespace Barotrauma
if (body.LinearVelocity.LengthSquared() > 0.000001f)
{
float dragCoefficient = 0.00001f;
float dragCoefficient = 0.01f;
float speedLength = (body.LinearVelocity == Vector2.Zero) ? 0.0f : body.LinearVelocity.Length();
float drag = speedLength * speedLength * dragCoefficient * mass;
@@ -259,9 +259,9 @@ namespace Barotrauma
float neutralPercentage = 0.07f;
float buoyancy = Math.Max(neutralPercentage - waterPercentage, -neutralPercentage*2.0f);
buoyancy *= mass * 30.0f;
buoyancy *= mass;
return new Vector2(0.0f, buoyancy);
return new Vector2(0.0f, buoyancy*10.0f);
}
public void ApplyForce(Vector2 force)
@@ -417,6 +417,7 @@ namespace Barotrauma
Vector2 lastContactPoint = worldPoints[0];
normal = Vector2.Normalize(ConvertUnits.ToDisplayUnits(body.Position) - cell.Center);
float impact = Vector2.Dot(Velocity, -normal);
+6 -4
View File
@@ -84,18 +84,20 @@ namespace Barotrauma
{
if (!editing && !GameMain.DebugDraw) return;
Point pos = new Point((int)Position.X, (int)Position.Y);
Rectangle drawRect =
Submarine == null ? rect : new Rectangle((int)(Submarine.DrawPosition.X + rect.X), (int)(Submarine.DrawPosition.Y + rect.Y), rect.Width, rect.Height);
Color clr = (isSelected) ? Color.Red : Color.LightGreen;
GUI.DrawRectangle(spriteBatch, new Rectangle(pos.X - rect.Width / 2, -pos.Y - rect.Height / 2, rect.Width, rect.Height), clr, true);
GUI.DrawRectangle(spriteBatch, new Rectangle(drawRect.X, -drawRect.Y, rect.Width, rect.Height), clr, true);
//spriteBatch.DrawString(GUI.SmallFont, Position.ToString(), new Vector2(Position.X, -Position.Y), Color.White);
foreach (MapEntity e in linkedTo)
{
GUI.DrawLine(spriteBatch,
new Vector2(pos.X, -pos.Y),
new Vector2(e.Position.X + e.Rect.Width / 2, -e.Position.Y + e.Rect.Height / 2),
new Vector2(drawRect.X, -drawRect.Y),
new Vector2(e.DrawPosition.X, -e.DrawPosition.Y),
Color.Green);
}
}