From d176dfedf3828a2fd8c42178789d8b5dff7d88d8 Mon Sep 17 00:00:00 2001 From: AnloGames <7383an@gmail.com> Date: Fri, 18 Aug 2023 19:52:48 +0300 Subject: [PATCH] debufgdsf kspdnisa --- DangerousD/GameCore/GUI/DebugHUD.cs | 4 +- .../GameCore/Managers/PhysicsManager.cs | 55 ------------------- 2 files changed, 2 insertions(+), 57 deletions(-) diff --git a/DangerousD/GameCore/GUI/DebugHUD.cs b/DangerousD/GameCore/GUI/DebugHUD.cs index c4e3e55..d864f75 100644 --- a/DangerousD/GameCore/GUI/DebugHUD.cs +++ b/DangerousD/GameCore/GUI/DebugHUD.cs @@ -28,7 +28,7 @@ namespace DangerousD.GameCore.GUI public void Draw(SpriteBatch spriteBatch) { - var keysString = Join("\n", _text.Select(el => el.Key + ": " + el.Value).ToList()); + /*var keysString = Join("\n", _text.Select(el => el.Key + ": " + el.Value).ToList()); spriteBatch.Begin(); spriteBatch.DrawString( _spriteFont, @@ -52,7 +52,7 @@ namespace DangerousD.GameCore.GUI SpriteEffects.None, 0 ); - spriteBatch.End(); + spriteBatch.End();*/ } public void Set(string key, string value) diff --git a/DangerousD/GameCore/Managers/PhysicsManager.cs b/DangerousD/GameCore/Managers/PhysicsManager.cs index 6ae5474..4a7d854 100644 --- a/DangerousD/GameCore/Managers/PhysicsManager.cs +++ b/DangerousD/GameCore/Managers/PhysicsManager.cs @@ -44,61 +44,6 @@ namespace DangerousD.GameCore.Managers var currentRect = currentEntity.Rectangle; var newRect = currentRect; - #region x collision - var collidedX = false; - var tryingRectX = currentRect; - tryingRectX.Offset((int)Math.Ceiling(currentEntity.velocity.X), 0); - foreach (var mapObject in mapObjects) - { - if ( - Math.Abs(mapObject.Pos.X - currentEntity.Pos.X) < 550 - && Math.Abs(mapObject.Pos.Y - currentEntity.Pos.Y) < 550 - && tryingRectX.Intersects(mapObject.Rectangle) - ) - { - collidedX = true; - break; - } - } - if (collidedX) - { - currentEntity.velocity.X = 0; - } - else - { - newRect.X = tryingRectX.X; - } - #endregion - - #region y collision - var collidedY = false; - var tryingRectY = currentRect; - tryingRectY.Offset(0, (int)Math.Ceiling(currentEntity.velocity.Y)); - if (currentEntity is Player) - { - AppManager.Instance.DebugHUD.Set("velocity", currentEntity.velocity.ToString()); - AppManager.Instance.DebugHUD.Set("falling", (currentEntity as Player).FallingThroughPlatform.ToString()); - AppManager.Instance.DebugHUD.Set("intersects y", ""); - } - foreach (var mapObject in mapObjects) - { - if (tryingRectY.Intersects(mapObject.Rectangle)) - { - if (currentEntity is Player) AppManager.Instance.DebugHUD.Set("intersects y", mapObject.GetType().ToString()); - collidedY = true; - break; - } - } - currentEntity.isOnGround = collidedY && currentEntity.velocity.Y > 0; - if (collidedY) - { - currentEntity.velocity.Y = 0; - } - else - { - newRect.Y = tryingRectY.Y; - } - #endregion currentEntity.SetPosition(new Vector2(newRect.X, newRect.Y)); }