private static bool WallCollision(Geometry.Circle2D c, double objectZ, double objectHeight, Wall wall) { if (Geometry.Intersections.CirclePolygonIntersection(c, wall.Area)) return true; return false; }
public Wall CreateWall(Polygon2D area) { var w = new Wall(); w.Area = area; return w; }
private void DrawWall(Wall w) { var wTex = ContentManager.Instance[w.WallTexture.TextureTag]; GL.BindTexture(TextureTarget.Texture2D, wTex.glID); double total = 0; foreach (var wx in w.Area.Lines) total += wx.Length; double runningTotal = 0; var wt = w.WallTexture; SetupTexture(wt); var c = w.Area.Center; GL.Begin(BeginMode.Quads); foreach (var wall in w.Area.Lines) { var l1 = new Line2D(c, wall.A); var l2 = new Line2D(c, wall.B); GL.Normal3(l1.Normal.X, 0, l1.Normal.Y); GL.TexCoord2((runningTotal / total), _gameInstance.CurrentLevel.BaseFloorHeight / wTex.Height); GL.Vertex3(wall.A.X, _gameInstance.CurrentLevel.BaseFloorHeight, wall.A.Y); GL.Normal3(l2.Normal.X, 0, l2.Normal.Y); GL.TexCoord2(((wall.Length + runningTotal) / total), _gameInstance.CurrentLevel.BaseFloorHeight / wTex.Height); GL.Vertex3(wall.B.X, _gameInstance.CurrentLevel.BaseFloorHeight, wall.B.Y); GL.Normal3(l2.Normal.X, 0, l2.Normal.Y); GL.TexCoord2(((wall.Length + runningTotal) / total), _gameInstance.CurrentLevel.BaseCeilingHeight / wTex.Height); GL.Vertex3(wall.B.X, _gameInstance.CurrentLevel.BaseCeilingHeight, wall.B.Y); GL.Normal3(l1.Normal.X, 0, l1.Normal.Y); GL.TexCoord2((runningTotal / total), _gameInstance.CurrentLevel.BaseCeilingHeight / wTex.Height); GL.Vertex3(wall.A.X, _gameInstance.CurrentLevel.BaseCeilingHeight, wall.A.Y); runningTotal += wall.Length; } GL.End(); }