diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Zombie.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Zombie.cs index da9e759..496382f 100644 --- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Zombie.cs +++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Zombie.cs @@ -18,6 +18,7 @@ namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies speed = 2; graphicsComponent.ObjectDrawRectangle = new Rectangle(0, 0, 30, 30); collisionComponent.stopRectangle = new Rectangle(10, 20, 10, 10); + StartAnimation("zombie_walk"); } public override void Update() @@ -29,12 +30,12 @@ namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies if (Random.Shared.NextDouble() > 0.9) { - StartAnimation("zombie_damaged"); + StartAnimation("zombie_walk"); } if (Random.Shared.NextDouble() > 0.9) { - StartAnimation("zombie_idle"); + //StartAnimation("zombie_idle"); } } diff --git a/ZoFo/GameCore/Server.cs b/ZoFo/GameCore/Server.cs index 01a01f0..baa753a 100644 --- a/ZoFo/GameCore/Server.cs +++ b/ZoFo/GameCore/Server.cs @@ -30,7 +30,7 @@ namespace ZoFo.GameCore { private ServerNetworkManager networkManager; private int ticks = 0; - public IPEndPoint MyIp { get { return networkManager.InfoConnect; } } + public IPEndPoint MyIp { get { return networkManager.InfoConnect; } } public Server() { networkManager = new ServerNetworkManager(); @@ -137,12 +137,10 @@ namespace ZoFo.GameCore //AppManager.Instance.server.RegisterGameObject(new EntittyForAnimationTests(new Vector2(0, 0))); AppManager.Instance.server.RegisterGameObject(new Player(new Vector2(740, 140))); - AppManager.Instance.server.RegisterGameObject(new Zombie(new Vector2(1000, 1000))); - AppManager.Instance.server.RegisterGameObject(new Zombie(new Vector2(1300, 1000))); - AppManager.Instance.server.RegisterGameObject(new Zombie(new Vector2(1500, 1000))); - AppManager.Instance.server.RegisterGameObject(new Zombie(new Vector2(1700, 1000))); - AppManager.Instance.server.RegisterGameObject(new Zombie(new Vector2(1900, 1000))); - AppManager.Instance.server.RegisterGameObject(new Zombie(new Vector2(2100, 1000))); + for (int i = 0; i < 20; i++) + for (int j = 0; j < 20; j++) + AppManager.Instance.server.RegisterGameObject(new Zombie(new Vector2(1300 + i*70, 1000+j*70))); + AppManager.Instance.server.RegisterGameObject(new Ammo(new Vector2(140, 440))); AppManager.Instance.server.RegisterGameObject(new Ammo(new Vector2(240, 440))); } @@ -159,7 +157,7 @@ namespace ZoFo.GameCore public List gameObjects; public List entities; //entity - public List players; + public List players; public void Update(GameTime gameTime) { if (ticks == 3) //ОБРАБАТЫВАЕТСЯ 20 РАЗ В СЕКУНДУ @@ -193,7 +191,7 @@ namespace ZoFo.GameCore sourceRectangle = new SerializableRectangle((gameObject as StopObject).sourceRectangle), Size = new SerializablePoint((gameObject as StopObject).graphicsComponent.ObjectDrawRectangle.Size), tileSetName = ((gameObject as StopObject).graphicsComponent as StaticGraphicsComponent)._textureName, - collisions = (gameObject as StopObject).collisionComponents.Select(x=>new SerializableRectangle(x.stopRectangle)).ToArray() + collisions = (gameObject as StopObject).collisionComponents.Select(x => new SerializableRectangle(x.stopRectangle)).ToArray() });//TODO foreach (var col in (gameObject as StopObject).collisionComponents) { @@ -209,17 +207,23 @@ namespace ZoFo.GameCore sourceRectangle = new SerializableRectangle((gameObject as MapObject).sourceRectangle), Size = new SerializablePoint((gameObject as MapObject).graphicsComponent.ObjectDrawRectangle.Size), tileSetName = ((gameObject as MapObject).graphicsComponent as StaticGraphicsComponent)._textureName - }); + }); return; } if (gameObject is Entity entity) { - AddData(new UpdateGameObjectCreated() { GameObjectType = gameObject.GetType().Name, IdEntity = entity.Id, - position = gameObject.position}); + AddData(new UpdateGameObjectCreated() + { + GameObjectType = gameObject.GetType().Name, + IdEntity = entity.Id, + position = gameObject.position + }); collisionManager.Register(entity.collisionComponent); } else - AddData(new UpdateGameObjectCreated() { GameObjectType = gameObject.GetType().Name, + AddData(new UpdateGameObjectCreated() + { + GameObjectType = gameObject.GetType().Name, position = gameObject.position }); @@ -233,7 +237,7 @@ namespace ZoFo.GameCore ////} } - + /// /// Удаляет игровой объект /// @@ -247,12 +251,12 @@ namespace ZoFo.GameCore if (players.Contains(entity)) players.Remove(entity as Player); AddData(new UpdateGameObjectDeleted() - { GameObjectType = entity.GetType().Name, IdEntity = entity .Id} + { GameObjectType = entity.GetType().Name, IdEntity = entity.Id } ); collisionManager.Deregister(entity.collisionComponent); } } - + #endregion #endregion