diff --git a/ZoFo/GameCore/GameManagers/CollisionManager/CollisionManager.cs b/ZoFo/GameCore/GameManagers/CollisionManager/CollisionManager.cs index a31acdb..513c6ae 100644 --- a/ZoFo/GameCore/GameManagers/CollisionManager/CollisionManager.cs +++ b/ZoFo/GameCore/GameManagers/CollisionManager/CollisionManager.cs @@ -208,7 +208,7 @@ namespace ZoFo.GameCore.GameManagers.CollisionManager } return players.ToArray(); } - public Entity[] GetEntities(Rectangle rectangle) + public Entity[] GetEntities(Rectangle rectangle, Entity entity) { List entities = new List(); @@ -219,6 +219,8 @@ namespace ZoFo.GameCore.GameManagers.CollisionManager entities.Add(item); } } + if (entities.Contains(entity)) + entities.Remove(entity); return entities.ToArray(); } diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs index 845128f..8c3310a 100644 --- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs +++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs @@ -91,12 +91,19 @@ public class Player : LivingEntity { IsTryingToShoot = true; - Rectangle rectangle = new Rectangle((int)position.X, (int)position.Y, 200, 200); - Entity[] entities = AppManager.Instance.server.collisionManager.GetEntities(rectangle); - DebugHUD.DebugSet("ent[0]", entities[0].ToString()); - if(entities != null){ - foreach (Entity entity in entities){ - AppManager.Instance.server.DeleteObject(entity); + var rect = collisionComponent.stopRectangle.SetOrigin(position); + rect.Width += 100; + rect.Height += 100; + Entity[] entities = AppManager.Instance.server.collisionManager.GetEntities(rect, this); + if (entities.Length>0) + { + DebugHUD.DebugSet("ent[0]", entities[0].ToString()); + if (entities != null) + { + foreach (Entity entity in entities) + { + AppManager.Instance.server.DeleteObject(entity); + } } } } diff --git a/ZoFo/GameCore/Graphics/AnimatedGraphicsComponent.cs b/ZoFo/GameCore/Graphics/AnimatedGraphicsComponent.cs index f93e9f8..85c4a7e 100644 --- a/ZoFo/GameCore/Graphics/AnimatedGraphicsComponent.cs +++ b/ZoFo/GameCore/Graphics/AnimatedGraphicsComponent.cs @@ -202,7 +202,7 @@ namespace ZoFo.GameCore.Graphics destinationRectangle = Scaling(destinationRectangle); _spriteBatch.Draw(texture, destinationRectangle, sourceRectangle, Color.White, Rotation, - Vector2.Zero, Flip, 0); + Vector2.Zero, Flip, (destinationRectangle.Y + destinationRectangle.Height) / 2000f); } public override void Draw(Rectangle destinationRectangle, SpriteBatch _spriteBatch, Rectangle sourceRectangle) { @@ -228,7 +228,7 @@ namespace ZoFo.GameCore.Graphics destinationRectangle = Scaling(destinationRectangle); _spriteBatch.Draw(texture, destinationRectangle, sourceRectangle, Color.White, 0, - Vector2.Zero, Flip, 0); + Vector2.Zero, Flip, (destinationRectangle.Y + destinationRectangle.Height) / 2000f); } private void buildSourceRectangle() { diff --git a/ZoFo/GameCore/Server.cs b/ZoFo/GameCore/Server.cs index d1e8950..a2b85d7 100644 --- a/ZoFo/GameCore/Server.cs +++ b/ZoFo/GameCore/Server.cs @@ -22,6 +22,7 @@ using ZoFo.GameCore.GameObjects.MapObjects; using ZoFo.GameCore.GameObjects.MapObjects.StopObjects; using ZoFo.GameCore.Graphics; using ZoFo.GameCore.GameManagers.NetworkManager.SerializableDTO; +using ZoFo.GameCore.GUI; namespace ZoFo.GameCore { @@ -79,7 +80,10 @@ namespace ZoFo.GameCore case "UpdatePlayerParametrs": break; case "UpdateInput": - players[0].HandleNewInput(updateData as UpdateInput); + if (players.Count > 0) + players[0].HandleNewInput(updateData as UpdateInput);//TODO id instead of 0 + else + DebugHUD.DebugLog("NO PLAYER ON MAP"); break; case "UpdateTileCreated": break; @@ -218,6 +222,7 @@ namespace ZoFo.GameCore position = gameObject.position }); collisionManager.Register(entity.collisionComponent); + entities.Add(entity); } else AddData(new UpdateGameObjectCreated()