diff --git a/ZoFo/Content/Content.mgcb b/ZoFo/Content/Content.mgcb index 3af7cd8..2fa4e0e 100644 --- a/ZoFo/Content/Content.mgcb +++ b/ZoFo/Content/Content.mgcb @@ -103,18 +103,6 @@ #begin Textures/Animations/testAnimationExample.animation /copy:Textures/Animations/testAnimationExample.animation -#begin Textures/AnimationTextures/Character/hr-level1_idle.png -/importer:TextureImporter -/processor:TextureProcessor -/processorParam:ColorKeyColor=255,0,255,255 -/processorParam:ColorKeyEnabled=True -/processorParam:GenerateMipmaps=False -/processorParam:PremultiplyAlpha=True -/processorParam:ResizeToPowerOfTwo=False -/processorParam:MakeSquare=False -/processorParam:TextureFormat=Color -/build:Textures/AnimationTextures/Character/hr-level1_idle.png - #begin Textures/AnimationTextures/Character/hr-level1_idle_gun.png /importer:TextureImporter /processor:TextureProcessor @@ -127,6 +115,18 @@ /processorParam:TextureFormat=Color /build:Textures/AnimationTextures/Character/hr-level1_idle_gun.png +#begin Textures/AnimationTextures/Character/hr-level1_idle.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Textures/AnimationTextures/Character/hr-level1_idle.png + #begin Textures/AnimationTextures/Character/hr-level1_mining_tool-1.png /importer:TextureImporter /processor:TextureProcessor @@ -151,18 +151,6 @@ /processorParam:TextureFormat=Color /build:Textures/AnimationTextures/Character/hr-level1_mining_tool-2.png -#begin Textures/AnimationTextures/Character/hr-level1_running.png -/importer:TextureImporter -/processor:TextureProcessor -/processorParam:ColorKeyColor=255,0,255,255 -/processorParam:ColorKeyEnabled=True -/processorParam:GenerateMipmaps=False -/processorParam:PremultiplyAlpha=True -/processorParam:ResizeToPowerOfTwo=False -/processorParam:MakeSquare=False -/processorParam:TextureFormat=Color -/build:Textures/AnimationTextures/Character/hr-level1_running.png - #begin Textures/AnimationTextures/Character/hr-level1_running_gun.png /importer:TextureImporter /processor:TextureProcessor @@ -175,6 +163,18 @@ /processorParam:TextureFormat=Color /build:Textures/AnimationTextures/Character/hr-level1_running_gun.png +#begin Textures/AnimationTextures/Character/hr-level1_running.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Textures/AnimationTextures/Character/hr-level1_running.png + #begin Textures/AnimationTextures/unicorn.png /importer:TextureImporter /processor:TextureProcessor @@ -271,18 +271,6 @@ /processorParam:TextureFormat=Color /build:Textures/GUI/background/waiting.png -#begin Textures/GUI/checkboxs_off.png -/importer:TextureImporter -/processor:TextureProcessor -/processorParam:ColorKeyColor=255,0,255,255 -/processorParam:ColorKeyEnabled=True -/processorParam:GenerateMipmaps=False -/processorParam:PremultiplyAlpha=True -/processorParam:ResizeToPowerOfTwo=False -/processorParam:MakeSquare=False -/processorParam:TextureFormat=Color -/build:Textures/GUI/checkboxs_off.png - #begin Textures/GUI/checkboxs_off-on.png /importer:TextureImporter /processor:TextureProcessor @@ -295,6 +283,18 @@ /processorParam:TextureFormat=Color /build:Textures/GUI/checkboxs_off-on.png +#begin Textures/GUI/checkboxs_off.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Textures/GUI/checkboxs_off.png + #begin Textures/GUI/checkboxs_on.png /importer:TextureImporter /processor:TextureProcessor @@ -331,6 +331,18 @@ /processorParam:TextureFormat=Color /build:Textures/GUI/mouse.png +#begin Textures/GUI/Switch_backgrownd.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Textures/GUI/Switch_backgrownd.png + #begin Textures/GUI/switch.png /importer:TextureImporter /processor:TextureProcessor @@ -343,7 +355,7 @@ /processorParam:TextureFormat=Color /build:Textures/GUI/switch.png -#begin Textures/GUI/Switch_backgrownd.png +#begin Textures/icons/12.png /importer:TextureImporter /processor:TextureProcessor /processorParam:ColorKeyColor=255,0,255,255 @@ -353,7 +365,115 @@ /processorParam:ResizeToPowerOfTwo=False /processorParam:MakeSquare=False /processorParam:TextureFormat=Color -/build:Textures/GUI/Switch_backgrownd.png +/build:Textures/icons/12.png + +#begin Textures/icons/13.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Textures/icons/13.png + +#begin Textures/icons/14.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Textures/icons/14.png + +#begin Textures/icons/21.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Textures/icons/21.png + +#begin Textures/icons/22.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Textures/icons/22.png + +#begin Textures/icons/5.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Textures/icons/5.png + +#begin Textures/icons/6.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Textures/icons/6.png + +#begin Textures/icons/7.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Textures/icons/7.png + +#begin Textures/icons/8.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Textures/icons/8.png + +#begin Textures/icons/9.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Textures/icons/9.png #begin Textures/TileSetImages/Tilelist1.png /importer:TextureImporter @@ -415,15 +535,3 @@ /processorParam:TextureFormat=Color /build:Textures/TileSetImages/TilesetFloor.png -#begin Textures/TileSetImages/TilesetFloor.png -/importer:TextureImporter -/processor:TextureProcessor -/processorParam:ColorKeyColor=255,0,255,255 -/processorParam:ColorKeyEnabled=True -/processorParam:GenerateMipmaps=False -/processorParam:PremultiplyAlpha=True -/processorParam:ResizeToPowerOfTwo=False -/processorParam:MakeSquare=False -/processorParam:TextureFormat=Color -/build:Textures/TileSetImages/TilesetFloor.png - diff --git a/ZoFo/GameCore/Client.cs b/ZoFo/GameCore/Client.cs index 00c2a91..5b7f1bd 100644 --- a/ZoFo/GameCore/Client.cs +++ b/ZoFo/GameCore/Client.cs @@ -19,6 +19,8 @@ using ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player; using System.Linq; using System.Web; using ZoFo.GameCore.GUI; +using ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables; +using ZoFo.GameCore.GameObjects.MapObjects.StopObjects; namespace ZoFo.GameCore { public class Client @@ -63,6 +65,7 @@ namespace ZoFo.GameCore List mapObjects = new List(); List gameObjects = new List(); + List stopObjects = new List(); /// /// Клиент должен обнговлять игру анимаций /// @@ -80,6 +83,10 @@ namespace ZoFo.GameCore { mapObjects[i].Draw(spriteBatch); } + for (int i = 0; i < stopObjects.Count; i++) + { + stopObjects[i].Draw(spriteBatch); + } for (int i = 0; i < gameObjects.Count; i++) { gameObjects[i].Draw(spriteBatch); @@ -88,7 +95,7 @@ namespace ZoFo.GameCore internal void GotData(UpdateData update) { - if (update is UpdateTileCreated) + if (update is UpdateTileCreated) { mapObjects.Add( new MapObject( @@ -98,13 +105,26 @@ namespace ZoFo.GameCore (update as UpdateTileCreated).tileSetName )); } + else if (update is UpdateStopObjectCreated) + { + stopObjects.Add( + new StopObject( + (update as UpdateStopObjectCreated).Position, + (update as UpdateStopObjectCreated).Size.ToVector2(), + (update as UpdateStopObjectCreated).sourceRectangle, + (update as UpdateStopObjectCreated).tileSetName, + (update as UpdateStopObjectCreated).collisions + )); + } else if (update is UpdateGameObjectCreated) { if ((update as UpdateGameObjectCreated).GameObjectType == "EntittyForAnimationTests") gameObjects.Add(new EntittyForAnimationTests((update as UpdateGameObjectCreated).position)); if ((update as UpdateGameObjectCreated).GameObjectType == "Player") gameObjects.Add(new Player((update as UpdateGameObjectCreated).position)); - + if ((update as UpdateGameObjectCreated).GameObjectType == "Ammo") + gameObjects.Add(new Ammo((update as UpdateGameObjectCreated).position)); + (gameObjects.Last() as Entity).SetIdByClient((update as UpdateGameObjectCreated).IdEntity); //var a = Assembly.GetAssembly(typeof(GameObject)); //gameObjects.Add( TODO reflection diff --git a/ZoFo/GameCore/GameManagers/CollisionManager/CollisionComponent.cs b/ZoFo/GameCore/GameManagers/CollisionManager/CollisionComponent.cs index 3ad2811..fa9f9d6 100644 --- a/ZoFo/GameCore/GameManagers/CollisionManager/CollisionComponent.cs +++ b/ZoFo/GameCore/GameManagers/CollisionManager/CollisionComponent.cs @@ -26,7 +26,7 @@ namespace ZoFo.GameCore.GameManagers.CollisionManager { this.gameObject = gameObject; - hasCollision = hasCollision; + this.hasCollision = hasCollision; this.isTrigger = isTrigger; if (hasCollision) this.stopRectangle = collisionRectangle.Value; diff --git a/ZoFo/GameCore/GameManagers/CollisionManager/CollisionManager.cs b/ZoFo/GameCore/GameManagers/CollisionManager/CollisionManager.cs index 7c0b998..25736fe 100644 --- a/ZoFo/GameCore/GameManagers/CollisionManager/CollisionManager.cs +++ b/ZoFo/GameCore/GameManagers/CollisionManager/CollisionManager.cs @@ -44,9 +44,12 @@ namespace ZoFo.GameCore.GameManagers.CollisionManager foreach (var item in ObjectsWithCollisions)//фильтрация { - if (Math.Abs(item.stopRectangle.X - entity.collisionComponent.stopRectangle.X) < 550 - && Math.Abs(item.stopRectangle.Y - entity.collisionComponent.stopRectangle.Y) < 550 - && tryingRectX.Intersects(item.stopRectangle)) + if (item == componentOfEntity) continue; + + Rectangle rectChecking = item.stopRectangle.SetOrigin(item.gameObject.position); + if (Math.Abs(item.gameObject.position.X - componentOfEntity.gameObject.position.X) < 550 + && Math.Abs(item.gameObject.position.Y - componentOfEntity.gameObject.position.Y) < 550 + && tryingRectX.Intersects(rectChecking)) { collidedX = true;// меняем значение соприкосновения на true @@ -75,9 +78,11 @@ namespace ZoFo.GameCore.GameManagers.CollisionManager foreach (var item in ObjectsWithCollisions)//фильтрация { - if (Math.Abs(item.stopRectangle.X - entity.collisionComponent.stopRectangle.X) < 550 - && Math.Abs(item.stopRectangle.Y - entity.collisionComponent.stopRectangle.Y) < 550 - && tryingRectY.Intersects(item.stopRectangle)) + if (item == componentOfEntity) continue; + Rectangle rectChecking = item.stopRectangle.SetOrigin(item.gameObject.position); + if (Math.Abs(item.gameObject.position.X - componentOfEntity.gameObject.position.X) < 550 + && Math.Abs(item.gameObject.position.Y - componentOfEntity.gameObject.position.Y) < 550 + && tryingRectY.Intersects(rectChecking)) { collidedY = true;// меняем значение соприкосновения на true @@ -135,4 +140,14 @@ namespace ZoFo.GameCore.GameManagers.CollisionManager } + public static class ExtentionClass + { + public static Rectangle SetOrigin(this Rectangle rectangle, Vector2 origin) + { + rectangle.X = (int)origin.X; + rectangle.Y = (int)origin.Y; + return rectangle; + } + } + } diff --git a/ZoFo/GameCore/GameManagers/MapManager/MapManager.cs b/ZoFo/GameCore/GameManagers/MapManager/MapManager.cs index d38ccbf..07b0e86 100644 --- a/ZoFo/GameCore/GameManagers/MapManager/MapManager.cs +++ b/ZoFo/GameCore/GameManagers/MapManager/MapManager.cs @@ -81,7 +81,7 @@ namespace ZoFo.GameCore.GameManagers.MapManager break; case "StopObject": var collisionRectangles = LoadRectangles(tile); // Грузит коллизии обьектов - AppManager.Instance.server.RegisterGameObject(new StopObject(position, + AppManager.Instance.server.RegisterGameObject(new StopObject(position/4,//TODO new Vector2(tileSet.TileWidth, tileSet.TileHeight), sourceRectangle, "Textures/TileSetImages/" + diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateTileCreated.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateTileCreated.cs index 0799653..2cf477b 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateTileCreated.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateTileCreated.cs @@ -23,4 +23,17 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient public Rectangle sourceRectangle { get; set; } public string tileSetName { get; set; } } + /// + /// При создании тайла TODO move to another file + /// + public class UpdateStopObjectCreated : UpdateData + { + public UpdateStopObjectCreated() { UpdateType = "UpdateStopObjectCreated"; } + public Texture2D TextureTile { get; set; } + public Vector2 Position { get; set; } + public Point Size { get; set; } + public Rectangle sourceRectangle { get; set; } + public string tileSetName { get; set; } + public Rectangle[] collisions { get; set; } + } } diff --git a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Ammo.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Ammo.cs index 040e461..fe3fb67 100644 --- a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Ammo.cs +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Ammo.cs @@ -13,10 +13,11 @@ namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables { class Ammo:Collectable { - public override GraphicsComponent graphicsComponent { get; } = new(new List { "Ammo" }, "Ammo"); + public override GraphicsComponent graphicsComponent { get; } = new("Textures/icons/8"); public Ammo(Vector2 position) : base(position) { - + graphicsComponent.ObjectDrawRectangle.Width = 20; + graphicsComponent.ObjectDrawRectangle.Height = 20; } public override void OnInteraction(object sender, CollisionComponent e) { diff --git a/ZoFo/GameCore/GameObjects/Entities/Interactables/Door.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Door.cs index 640c9c1..06e7e8b 100644 --- a/ZoFo/GameCore/GameObjects/Entities/Interactables/Door.cs +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Door.cs @@ -13,7 +13,7 @@ public class Door : Interactable public Door(Vector2 position) : base(position) { - graphicsComponent.OnAnimationEnd += _ => { isOpened = !isOpened; }; + graphicsComponent.OnAnimationEnd += _ => { isOpened = !isOpened; };//, - SD } public override void OnInteraction(object sender, CollisionComponent e) diff --git a/ZoFo/GameCore/GameObjects/MapObjects/MapObject.cs b/ZoFo/GameCore/GameObjects/MapObjects/MapObject.cs index 15ac53c..1c2b5b3 100644 --- a/ZoFo/GameCore/GameObjects/MapObjects/MapObject.cs +++ b/ZoFo/GameCore/GameObjects/MapObjects/MapObject.cs @@ -36,6 +36,8 @@ namespace ZoFo.GameCore.GameObjects.MapObjects public override void Draw(SpriteBatch spriteBatch) { graphicsComponent.DrawAnimation(graphicsComponent.ObjectDrawRectangle, spriteBatch, sourceRectangle); + + } } diff --git a/ZoFo/GameCore/GameObjects/MapObjects/StopObjects/StopObject.cs b/ZoFo/GameCore/GameObjects/MapObjects/StopObjects/StopObject.cs index 87e44c0..5ef0c2d 100644 --- a/ZoFo/GameCore/GameObjects/MapObjects/StopObjects/StopObject.cs +++ b/ZoFo/GameCore/GameObjects/MapObjects/StopObjects/StopObject.cs @@ -1,23 +1,32 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using System.Diagnostics; +using System.Security.Cryptography.X509Certificates; using ZoFo.GameCore.GameManagers.CollisionManager; namespace ZoFo.GameCore.GameObjects.MapObjects.StopObjects; public class StopObject : MapObject { - CollisionComponent[] collisionComponent; + public CollisionComponent[] collisionComponents; public StopObject(Vector2 position, Vector2 size, Rectangle sourceRectangle, string textureName, Rectangle[] collisions) : base(position, size, sourceRectangle, textureName) { - collisionComponent = new CollisionComponent[collisions.Length]; - for (int i = 0; i < collisionComponent.Length; i++) + + collisionComponents = new CollisionComponent[collisions.Length]; + for (int i = 0; i < collisionComponents.Length; i++) { - collisionComponent[i] = new CollisionComponent(this, true, collisions[i]); + collisionComponents[i] = new CollisionComponent(this, true, new Rectangle(0,0, (int)size.X, (int)size.Y)/*collisions[i]*/); } + //REDO // TODO: Написать коллизию, пусть тразмер будет чисто таким же как и текстурка. // Поменяйте уровень защиты конструктора, после снимите в MapManager комментарий в методе LoadMap с создания StopObject-а } + public override void Draw(SpriteBatch spriteBatch) + { + base.Draw(spriteBatch); + DrawDebugRectangle(spriteBatch, new Rectangle((int)position.X, (int)position.Y, collisionComponents[0].stopRectangle.Width, collisionComponents[0].stopRectangle.Height)); + } } diff --git a/ZoFo/GameCore/Server.cs b/ZoFo/GameCore/Server.cs index 17502b9..575778e 100644 --- a/ZoFo/GameCore/Server.cs +++ b/ZoFo/GameCore/Server.cs @@ -15,9 +15,11 @@ using ZoFo.GameCore.GameManagers.NetworkManager.Updates; using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient; using ZoFo.GameCore.GameObjects; using ZoFo.GameCore.GameObjects.Entities; +using ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables; using ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies; using ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player; using ZoFo.GameCore.GameObjects.MapObjects; +using ZoFo.GameCore.GameObjects.MapObjects.StopObjects; namespace ZoFo.GameCore { @@ -95,11 +97,11 @@ namespace ZoFo.GameCore collisionManager = new CollisionManager(); gameObjects = new List(); entities = new List(); - //new MapManager().LoadMap(); + new MapManager().LoadMap(); AppManager.Instance.server.RegisterGameObject(new EntittyForAnimationTests(new Vector2(40, 40))); - AppManager.Instance.server.RegisterGameObject(new Player(new Vector2(140, 140))); - AppManager.Instance.server.RegisterGameObject(new Player(new Vector2(140, 140))); + AppManager.Instance.server.RegisterGameObject(new Player(new Vector2(740, 140))); + AppManager.Instance.server.RegisterGameObject(new Ammo(new Vector2(140, 440))); } /// @@ -139,6 +141,23 @@ namespace ZoFo.GameCore { gameObjects.Add(gameObject); + if (gameObject is StopObject) + { + AddData(new UpdateStopObjectCreated() + { + Position = (gameObject as StopObject).position, + sourceRectangle = (gameObject as StopObject).sourceRectangle, + Size = (gameObject as StopObject).graphicsComponent.ObjectDrawRectangle.Size, + collisions = (gameObject as StopObject).collisionComponents.Select(x=>x.stopRectangle).ToArray(), + tileSetName = (gameObject as StopObject).graphicsComponent.mainTextureName + });//TODO + foreach (var item in (gameObject as StopObject).collisionComponents) + { + collisionManager.Register(item); + + } + return; + } if (gameObject is MapObject) { AddData(new UpdateTileCreated() @@ -152,11 +171,14 @@ namespace ZoFo.GameCore } if (gameObject is Entity) { - AddData(new UpdateGameObjectCreated() { GameObjectType = gameObject.GetType().Name, IdEntity = (gameObject as Entity).Id }); + AddData(new UpdateGameObjectCreated() { GameObjectType = gameObject.GetType().Name, IdEntity = (gameObject as Entity).Id, + position = gameObject.position}); collisionManager.Register((gameObject as Entity).collisionComponent); } else - AddData(new UpdateGameObjectCreated() { GameObjectType = gameObject.GetType().Name }); + AddData(new UpdateGameObjectCreated() { GameObjectType = gameObject.GetType().Name, + position = gameObject.position + }); ////var elems = gameObject.GetType().GetProperties(System.Reflection.BindingFlags.Public);